List of usage examples for android.content SharedPreferences edit
Editor edit();
From source file:Main.java
public static void storeFloat(Context context, String key, float value) { SharedPreferences pre = context.getSharedPreferences(STORE_NAME, Context.MODE_PRIVATE); pre.edit().putFloat(STORE_KEY_PREFIX + key, value).commit(); }
From source file:Main.java
private static void setCookie(String str) { SharedPreferences sp = app.getSharedPreferences("_cookie", Context.MODE_PRIVATE); sp.edit().putString(key, str).commit(); mCookie = str;//from w ww . ja v a 2s. c o m }
From source file:Main.java
public static void storeString(Context context, String key, String value) { SharedPreferences pre = context.getSharedPreferences(STORE_NAME, Context.MODE_PRIVATE); pre.edit().putString(STORE_KEY_PREFIX + key, value).commit(); }
From source file:Main.java
public static void storeBoolean(Context context, String key, boolean value) { SharedPreferences pre = context.getSharedPreferences(STORE_NAME, Context.MODE_PRIVATE); pre.edit().putBoolean(STORE_KEY_PREFIX + key, value).commit(); }
From source file:Main.java
public static void storeLong(Context context, String key, long value) { SharedPreferences pre = context.getSharedPreferences(STORE_NAME, Context.MODE_PRIVATE); pre.edit().putLong(STORE_KEY_PREFIX + key, value).commit(); }
From source file:Main.java
public static void setSettingLong(Context context, final String key, final long value) { final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context); settings.edit().putLong(key, value).apply(); }
From source file:Main.java
public static void putString(Context context, String key, String value) { try {// ww w.j a va 2s .com SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); sp.edit().putString(key, value).apply(); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void storeInteger(Context context, String key, int value) { SharedPreferences pre = context.getSharedPreferences(STORE_NAME, Context.MODE_APPEND); pre.edit().putInt(STORE_KEY_PREFIX + key, value).commit(); }
From source file:Main.java
public static void setIsRunning(Context context, boolean isRunning) { SharedPreferences sp = context.getSharedPreferences(EXT_CONFIG, Context.MODE_PRIVATE); sp.edit().putBoolean(KEY_IS_RUNNING, isRunning).commit(); }
From source file:Main.java
public static void setPrefBoolean(Context context, final String key, final boolean value) { final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context); settings.edit().putBoolean(key, value).apply(); }