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


Java Editor.putBoolean方法代码示例

本文整理汇总了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);
}
 
开发者ID:Webtrekk,项目名称:webtrekk-android-sdk,代码行数:17,代码来源:Core.java

示例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();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:13,代码来源:PreferenceHelper.java

示例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();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:8,代码来源:PreferenceHelper.java

示例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();
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:13,代码来源:ConfigParamsKeeper.java

示例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();
    }
 
开发者ID:PacktPublishing,项目名称:Expert-Android-Programming,代码行数:12,代码来源:SessionPreference.java

示例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();
  }
 
开发者ID:MUFCRyan,项目名称:BilibiliClient,代码行数:9,代码来源:PreferenceUtil.java

示例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();
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:9,代码来源:PreferencesManager.java

示例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();
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:6,代码来源:PreferencesManager.java

示例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();
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:6,代码来源:PreferencesManager.java

示例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();
}
 
开发者ID:bunnyblue,项目名称:NoticeDog,代码行数:6,代码来源:Settings.java

示例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();
}
 
开发者ID:dvdciri,项目名称:DeepImagePreview-Project,代码行数:6,代码来源:Prefs.java

示例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();
}
 
开发者ID:abook23,项目名称:godlibrary,代码行数:6,代码来源:SharedPreferencesUtils.java

示例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();
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:7,代码来源:CDKPreference.java

示例14: regist

import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
public void regist(){
	Editor editor = mSharedPref.edit();
	editor.putBoolean(IS_REGIST, true);
	editor.commit();
}
 
开发者ID:inceleb,项目名称:InstagramManager-Android,代码行数:6,代码来源:InstagramSession.java

示例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);
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:6,代码来源:BaseApplication.java


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