本文整理匯總了Java中android.content.SharedPreferences.Editor.putBoolean方法的典型用法代碼示例。如果您正苦於以下問題:Java Editor.putBoolean方法的具體用法?Java Editor.putBoolean怎麽用?Java Editor.putBoolean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.content.SharedPreferences.Editor
的用法示例。
在下文中一共展示了Editor.putBoolean方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setupSampling
import android.content.SharedPreferences.Editor; //導入方法依賴的package包/類
private void setupSampling() {
SharedPreferences preferences = this.context.getSharedPreferences(PREFERENCES_FILE_NAME, Context.MODE_PRIVATE);
if (preferences.getInt(PREFERENCE_KEY_SAMPLING_RATE, 0) == this.samplingRate) {
this.isSampling = preferences.getBoolean(PREFERENCE_KEY_IS_SAMPLING, true);
}
else {
this.isSampling = (this.samplingRate <= 0 || new Random().nextInt(this.samplingRate) == 0);
Editor editor = preferences.edit();
editor.putBoolean(PREFERENCE_KEY_IS_SAMPLING, this.isSampling);
editor.putInt(PREFERENCE_KEY_SAMPLING_RATE, this.samplingRate);
editor.commit();
}
this.log("isSampling = " + this.isSampling + ", samplingRate = " + this.samplingRate);
}
示例2: setJellybeanRootRan
import android.content.SharedPreferences.Editor; //導入方法依賴的package包/類
/**
* Record that we managed to get root in JellyBean.
*
* @param context
* @return
*/
public static void setJellybeanRootRan(Context context) {
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
Editor editor = sharedPrefs.edit();
editor.putBoolean(context.getString(R.string.pref_ran_jellybean_su_update), true);
editor.commit();
}
示例3: setIncludeDeviceInfoPreference
import android.content.SharedPreferences.Editor; //導入方法依賴的package包/類
public static void setIncludeDeviceInfoPreference(Context context, boolean value) {
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
Editor editor = sharedPrefs.edit();
editor.putBoolean(context.getString(R.string.pref_include_device_info), value);
editor.apply();
}
示例4: setValue
import android.content.SharedPreferences.Editor; //導入方法依賴的package包/類
/***
* 設置配置值
*
* param key 配置變量名
* param value 配置數值
*/
public void setValue(String key, boolean flag) {
SharedPreferences preferences = context.getSharedPreferences(KEEPERNAME, Context.MODE_PRIVATE);
Editor editor = preferences.edit();
editor.putBoolean(key, flag);
editor.apply();
}
示例5: setUserParams
import android.content.SharedPreferences.Editor; //導入方法依賴的package包/類
public static boolean setUserParams(Context context, User user) {
Editor editor = context.getSharedPreferences(KEY, Context.MODE_PRIVATE).edit();
editor.putInt(ID, user.getId());
editor.putString(NAME, user.getName());
editor.putString(EMAIL, user.getEmail());
editor.putString(IMAGE, user.getImage());
editor.putString(UID, user.getUid());
editor.putBoolean(IS_LOGGED_IN, true);
return editor.commit();
}
示例6: putBoolean
import android.content.SharedPreferences.Editor; //導入方法依賴的package包/類
public static void putBoolean(String key, boolean value) {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(
BilibiliApp.getInstance());
Editor editor = sharedPreferences.edit();
editor.putBoolean(key, value);
editor.apply();
}
示例7: setGameShow
import android.content.SharedPreferences.Editor; //導入方法依賴的package包/類
public void setGameShow(boolean isShow) {
Editor editor = context.getSharedPreferences(SETTINGS, 4).edit();
editor.putBoolean("isGameShow", isShow);
if (LetvUtils.isSpecialChannel()) {
editor.putBoolean("isGameShow", false);
}
editor.commit();
}
示例8: setHaveLoginPage
import android.content.SharedPreferences.Editor; //導入方法依賴的package包/類
public void setHaveLoginPage(boolean flag) {
Editor editor = context.getSharedPreferences(HAVELOGINPAGEKEY, 0).edit();
editor.putBoolean("have_login_page", flag);
editor.commit();
}
示例9: setChannelShow
import android.content.SharedPreferences.Editor; //導入方法依賴的package包/類
public void setChannelShow(boolean isShow) {
Editor editor = context.getSharedPreferences(SETTINGS, 4).edit();
editor.putBoolean("isChannelShow", isShow);
editor.commit();
}
示例10: setEnableHeadsUpNotification
import android.content.SharedPreferences.Editor; //導入方法依賴的package包/類
public void setEnableHeadsUpNotification(boolean enableHeadsUpNotification) {
Editor editor = PreferenceManager.getDefaultSharedPreferences(this.context).edit();
editor.putBoolean(KEY_ENABLE_HEADSUP_NOTIFICATION, enableHeadsUpNotification);
editor.commit();
}
示例11: savePreference
import android.content.SharedPreferences.Editor; //導入方法依賴的package包/類
private static void savePreference(Context context, String prefKey, Boolean newValue) {
Editor editor = PreferenceManager.getDefaultSharedPreferences(context).edit();
editor.putBoolean(prefKey, newValue);
editor.apply();
}
示例12: putBoolean
import android.content.SharedPreferences.Editor; //導入方法依賴的package包/類
public void putBoolean(String key, boolean value) {
Editor edt = sharedPreferences.edit();
edt.putBoolean(key, value);
edt.commit();
}
示例13: putBooleanTemp
import android.content.SharedPreferences.Editor; //導入方法依賴的package包/類
public static boolean putBooleanTemp(String key, boolean value)
{
Editor editor = editTemp();
editor.putBoolean(key, value);
return editor.commit();
}
示例14: regist
import android.content.SharedPreferences.Editor; //導入方法依賴的package包/類
public void regist(){
Editor editor = mSharedPref.edit();
editor.putBoolean(IS_REGIST, true);
editor.commit();
}
示例15: set
import android.content.SharedPreferences.Editor; //導入方法依賴的package包/類
public static void set(String key, boolean value) {
Editor editor = getPreferences().edit();
editor.putBoolean(key, value);
SharedPreferencesCompat.EditorCompat.getInstance().apply(editor);
}