List of usage examples for android.content SharedPreferences edit
Editor edit();
From source file:Main.java
public static void setPlaymode(Context context, String key, int value) { SharedPreferences sp = context.getSharedPreferences("atguigu", Context.MODE_PRIVATE); sp.edit().putInt(key, value).commit(); }
From source file:Main.java
public static void removeContentFromSharedPreferences(SharedPreferences sharedPreferences, String key) { Editor editor = sharedPreferences.edit(); String msg = sharedPreferences.getString(key, null); editor.remove(key);//w w w. j ava 2 s . c o m editor.commit(); }
From source file:Main.java
public static void putBoolean(Context mContext, String key, boolean value) { SharedPreferences sp = mContext.getSharedPreferences("atguigu", Context.MODE_PRIVATE); sp.edit().putBoolean(key, value).commit(); }
From source file:Main.java
public static void setGuideShowedPrefs(Context context, String key, boolean value) { SharedPreferences sp = context.getSharedPreferences(PRE_NAME, Context.MODE_PRIVATE); sp.edit().putBoolean(key, value).commit(); }
From source file:Main.java
public static void setTextSizePrefs(Context context, String key, int value) { SharedPreferences sp = context.getSharedPreferences(PRE_NAME, Context.MODE_PRIVATE); sp.edit().putInt(key, value).commit(); }
From source file:Main.java
public static void setSelectedAccount(Context context, String accoutName) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); prefs.edit().putString(PREF_SELECTED_ACCOUNT, accoutName).apply(); }
From source file:Main.java
public static void setChangeMode(Context ctx, int mode) { SharedPreferences sp = ctx.getSharedPreferences("config_mode", Context.MODE_PRIVATE); sp.edit().putInt(Mode, mode).commit(); }
From source file:Main.java
public static void cachePullSen(Context context, float sen) { SharedPreferences sp = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE); sp.edit().putFloat(KEY_PS, sen).commit(); }
From source file:Main.java
public static void cacheFlyDuration(Context context, long time) { SharedPreferences sp = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE); sp.edit().putLong(KEY_BD, time).commit(); }
From source file:Main.java
public static void cacheLineLength(Context context, int lineLen) { SharedPreferences sp = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE); sp.edit().putInt(KEY_LL, lineLen).commit(); }