当前位置: 首页>>代码示例>>Java>>正文


Java Editor.clear方法代码示例

本文整理汇总了Java中android.content.SharedPreferences.Editor.clear方法的典型用法代码示例。如果您正苦于以下问题:Java Editor.clear方法的具体用法?Java Editor.clear怎么用?Java Editor.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.SharedPreferences.Editor的用法示例。


在下文中一共展示了Editor.clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: putAllBoolean

import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
/**设置所有boolean
 * @param values
 */
public static void putAllBoolean(boolean[] values){
	if (values == null || values.length != KEYS.length) {
		Log.e(TAG, "putAllBoolean  values == null || values.length != KEYS.length >> return;");
		return;
	}

	Editor editor = context.getSharedPreferences(APP_SETTING, Context.MODE_PRIVATE).edit();
	editor.clear();
	for (int i = 0; i < values.length; i++) {
		editor.putBoolean(KEYS[i], values[i]);
	}
	editor.commit();

	init(context);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:SettingUtil.java

示例2: onSharedPreferenceChanged

import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
        String key) {
    if (PREF_SELECTED_LANGUAGES.equals(key)) {
        mLanguageSwitcher.loadLocales(sharedPreferences);
        mRefreshKeyboardRequired = true;
    } else if (PREF_RECORRECTION_ENABLED.equals(key)) {
        mReCorrectionEnabled = sharedPreferences.getBoolean(PREF_RECORRECTION_ENABLED,
                getResources().getBoolean(R.bool.default_recorrection_enabled));
    }
    if (PREF_KP2A_REMEMBER_AUTO_FILL.equals(key))
    {
    	if (sharedPreferences.getBoolean(key, true) == false)
    	{
    		Log.d("KP2AK", "clearing saved field hints");
    		SharedPreferences savedHints = getApplicationContext().getSharedPreferences(KP2A_SAVED_FIELD_HINTS, MODE_PRIVATE);
    		Editor edit = savedHints.edit();
			edit.clear();
			edit.commit();

    	}
    }
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:23,代码来源:KP2AKeyboard.java

示例3: clearSharedPreference

import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
/**
 * Clear Shared Preferences method
 * @param context
 */
public static void clearSharedPreference(@NonNull Context context) {
    SharedPreferences settings;
    Editor editor;

    settings = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
    editor = settings.edit();

    editor.clear();
    editor.apply();
}
 
开发者ID:YoeriNijs,项目名称:NoteBuddy,代码行数:15,代码来源:KeyValueDB.java

示例4: clear

import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
public static void clear(Context context, String fileName) {
    SharedPreferences sp = SharedPreferencesImpl.getSharedPreferences(context, getFileName(fileName),
            Context.MODE_PRIVATE);
    Editor editor = sp.edit();
    editor.clear();
    editor.apply();
}
 
开发者ID:miLLlulei,项目名称:Accessibility,代码行数:8,代码来源:SPUtils.java

示例5: clear

import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
/**
 * 清除所有内容
 *
 * @param context
 */
public static void clear(Context context) {
    SharedPreferences sp = context.getSharedPreferences(FILL_NAME, Context.MODE_PRIVATE);
    Editor edit = sp.edit();
    edit.clear();
    SharedPreferencesCompat.EditorCompat.getInstance().apply(edit);
}
 
开发者ID:XYScience,项目名称:StopApp,代码行数:12,代码来源:SharedPreferenceUtil.java

示例6: clearExtras

import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
protected static void clearExtras(Context context) {
    SharedPreferences sharedPreferences = context.getSharedPreferences("mipush_extra", 0);
    long j = sharedPreferences.getLong("wake_up", 0);
    Editor edit = sharedPreferences.edit();
    edit.clear();
    if (j > 0) {
        edit.putLong("wake_up", j);
    }
    edit.commit();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:11,代码来源:MiPushClient.java

示例7: clear

import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
/**
 * 清空 SharedPreferences 中 Token信息。
 *
 * @param context 应用程序上下文环境
 */
public static void clear(Context context) {
    if (null == context) {
        return;
    }

    SharedPreferences pref = context.getSharedPreferences(PREFERENCES_NAME, Context.MODE_APPEND);
    Editor editor = pref.edit();
    editor.clear();
    editor.commit();
}
 
开发者ID:yangjie127,项目名称:ESSocialSDK-master,代码行数:16,代码来源:AccessTokenKeeper.java

示例8: writeDataToSharePreference

import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
public static void writeDataToSharePreference(Context context, String str, String str2, String str3) {
    if (str3 != null) {
        Editor edit = context.getSharedPreferences(str, 0).edit();
        if (edit != null) {
            edit.clear();
            edit.putString(str2, str3);
            edit.commit();
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:11,代码来源:SharePreferenceStorage.java

示例9: clear

import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
public static boolean clear(Context context) {

        Editor editor = getSharedPreference(context).edit();
        editor.clear();
        return editor.commit();
    }
 
开发者ID:PacktPublishing,项目名称:Expert-Android-Programming,代码行数:7,代码来源:ImagePreference.java

示例10: deleteAllOldPreferences

import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
private void deleteAllOldPreferences() {
	Editor editor = mOldPrefs.edit();
	editor.clear();
	editor.commit();
}
 
开发者ID:treasure-lau,项目名称:Linphone4Android,代码行数:6,代码来源:PreferencesMigrator.java

示例11: clear

import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
public static void clear(Context context) {
    Editor editor = context.getSharedPreferences(KEY, Context.MODE_PRIVATE)
            .edit();
    editor.clear();
    editor.commit();
}
 
开发者ID:vuatovuanang,项目名称:WebRTC-VideoCall-Anrdoid,代码行数:7,代码来源:MySharePreference.java

示例12: clear

import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
public static boolean clear(Context context) {
    Editor editor = context.getSharedPreferences(KEY, Context.MODE_PRIVATE).edit();
    editor.clear();
    return editor.commit();
}
 
开发者ID:PacktPublishing,项目名称:Expert-Android-Programming,代码行数:6,代码来源:SessionPreference.java

示例13: clear

import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
public static void clear(Context ctx) {
    Editor editor = sharedPreferences.edit();
    editor.clear();
    editor.commit();
}
 
开发者ID:jiajieshen,项目名称:AndroidDevSamples,代码行数:6,代码来源:SPUtil.java

示例14: clear

import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
public static void clear(Context context) {
    Editor editor = context.getSharedPreferences(FILE_NAME, 0).edit();
    editor.clear();
    SharedPreferencesCompat.apply(editor);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:6,代码来源:SharedPreferenceUtils.java

示例15: clearPreferences

import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
public static void clearPreferences(Context context) {
    Editor editor = PreferenceManager.getDefaultSharedPreferences(context).edit();
    editor.clear();
    editor.apply();
}
 
开发者ID:dvdciri,项目名称:DeepImagePreview-Project,代码行数:6,代码来源:Prefs.java


注:本文中的android.content.SharedPreferences.Editor.clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。