List of usage examples for android.content SharedPreferences edit
Editor edit();
From source file:Main.java
public static void remove(Context context, String key) { SharedPreferences sp = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sp.edit(); editor.remove(key);//from ww w . j a v a2 s. c o m editor.commit(); }
From source file:Main.java
public static void setCameraActive(Context context, boolean fl) { SharedPreferences sd = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sd.edit(); editor.putBoolean(CAMERA_ACTIVE, fl); editor.commit();//from ww w .j a v a 2 s . c o m }
From source file:Main.java
public static void setApplicationBooleanPreferences(Context context, String name, boolean value) { SharedPreferences sharedPreferences = context.getSharedPreferences(PREFS_NAME, 0); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putBoolean(name, value);//w ww .ja va 2 s . c om editor.commit(); }
From source file:Main.java
public static void setTimeActive(Context context, boolean fl) { SharedPreferences sd = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sd.edit(); editor.putBoolean(TIME_ACTIVE, fl); editor.commit();/*from ww w . ja va 2 s . c o m*/ }
From source file:Main.java
public static void SetHasSeenBefore(String name, Context context) { SharedPreferences sharedPrefs = context.getSharedPreferences(prefCategoryName, Activity.MODE_PRIVATE); Editor editor = sharedPrefs.edit(); editor.putBoolean(name, true);//from ww w. j a v a2 s .co m editor.commit(); }
From source file:Main.java
public static void cleanAllSP(Context context) { String packageName = context.getPackageName(); SharedPreferences sp = context.getSharedPreferences(packageName, Context.MODE_PRIVATE); Editor editor = sp.edit(); editor.clear();/*from w w w . j a va 2s .c o m*/ editor.apply(); }
From source file:Main.java
public static void clearSharePrefrences(Context context) { SharedPreferences sp = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sp.edit(); editor.clear();/* w ww . ja va2s. c om*/ editor.commit(); }
From source file:Main.java
public static void clear(Context context) { SharedPreferences sp = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sp.edit(); editor.clear();/* www. ja v a2 s. c o m*/ editor.commit(); }
From source file:Main.java
public static void set(Context context, String key, String value) { SharedPreferences preferences = context.getSharedPreferences(CONFIG_FILE_NAME, Context.MODE_PRIVATE); Editor editor = preferences.edit(); editor.putString(key, value);/* w w w .ja va 2 s . c o m*/ editor.commit(); }
From source file:Main.java
public static void setShowIntroduce(Context context) { SharedPreferences sp = context.getSharedPreferences("alumni", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = sp.edit(); editor.putBoolean("showintro", true); editor.commit();//w ww . ja v a2s . c o m }