當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。