本文整理汇总了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);
}