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