List of usage examples for android.content SharedPreferences edit
Editor edit();
From source file:Main.java
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) public static void setBeamUnlocked(Context context) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); prefs.edit().putInt(PREF_BEAM_STATE, BEAM_STATE_UNLOCKED).commit(); }
From source file:Main.java
public static void saveValueToPublicSharedPreferences(Context context, String key, String Value) { SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context); Editor editor = settings.edit(); editor.putString(key, Value);/*w ww . j a va2 s.c o m*/ editor.commit(); }
From source file:Main.java
public static void clean(Context cxt, String fileName) { SharedPreferences preference = cxt.getSharedPreferences(fileName, Context.MODE_PRIVATE); Editor editor = preference.edit(); editor.clear();/*www. j a va 2 s .c o m*/ editor.commit(); }
From source file:Main.java
public static void setMigrationUpdateHandled(Context context) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); preferences.edit().putBoolean(KEY_MIGRATION_UPDATED_HANDLED, true).apply(); }
From source file:Main.java
public static void setResolution(Context ctt, String resolution) { if (ctt != null) { SharedPreferences sp = ctt.getSharedPreferences(PREFERENCES_PLAY_RESOLUTION, Context.MODE_PRIVATE); sp.edit().putString(KEY_PLAY_RESOLUTION, resolution).commit(); }/*from ww w. j av a2 s .com*/ }
From source file:Main.java
public static boolean saveSet(SharedPreferences prefs, Set<String> set, String setName) { SharedPreferences.Editor editor = prefs.edit(); final int setSize = set.size(); editor.putInt(setName + "_size", setSize); int i = 0;//from www .j a va2s. c o m for (String s : set) { editor.putString(setName + "_" + i, s); ++i; } return editor.commit(); }
From source file:Main.java
public static void putStringToSP(Context con, String key, String value) { SharedPreferences pref = con.getSharedPreferences(PREFERENCE_NAME, 0); SharedPreferences.Editor editor = pref.edit(); editor.putString(key, value);//ww w . j ava 2 s . c o m editor.commit(); }
From source file:Main.java
public static boolean putString(Context context, String tag, String value) { SharedPreferences prefs = getSharedPreference(context); SharedPreferences.Editor editor = prefs.edit(); editor.putString(tag, value);//from w w w .j a v a 2s. c om return editor.commit(); }
From source file:Main.java
public static void setBind(Context context, boolean flag) { String flagStr = "not"; if (flag) {//w w w.j a v a 2 s . c o m flagStr = "ok"; } SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); Editor editor = sp.edit(); editor.putString("bind_flag", flagStr); editor.commit(); }
From source file:Main.java
public static void setUiDisabledForMigration(Context context, boolean uiDisabled) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); preferences.edit().putBoolean(KEY_UI_DISABLED_FOR_MIGRATION, uiDisabled).apply(); }