List of usage examples for android.content SharedPreferences edit
Editor edit();
From source file:Main.java
public static void cacheBalloonCount(Context context, int count) { SharedPreferences sp = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE); sp.edit().putInt(KEY_BC, count).commit(); }
From source file:Main.java
public static void putBoolean(Context context, String key, Boolean value) { SharedPreferences sp = context.getSharedPreferences("atguigu", Context.MODE_PRIVATE); sp.edit().putBoolean(key, value).commit(); }
From source file:Main.java
public static void cacheOnlyDestop(Context context, boolean onlyDestop) { SharedPreferences sp = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE); sp.edit().putBoolean(KEY_ONLY_DESTOP, onlyDestop).commit(); }
From source file:Main.java
public static void putString(Context mContext, String key, String value) { SharedPreferences sp = mContext.getSharedPreferences("atguigu", Context.MODE_PRIVATE); sp.edit().putString(key, value).commit(); }
From source file:Main.java
public static void deleteKeyFromPreferencesIfThere(String key, SharedPreferences sharedPreferences) { SharedPreferences.Editor editor = sharedPreferences.edit(); editor.remove(key);/*w w w . j a v a2 s. co m*/ editor.commit(); }
From source file:Main.java
public static boolean saveThreeInOneCityUpdateTime(Context context, String updateTime) { SharedPreferences prefs = getSharedPreference(context); Editor editor = prefs.edit(); editor.putString(THREE_IN_ONE_UPDATE_TIME, updateTime); return editor.commit(); }
From source file:Main.java
public static void setString(Context ctx, String key, String value) { SharedPreferences sp = ctx.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); sp.edit().putString(key, value).apply(); }
From source file:Main.java
public static void setLong(Context context, String key, long value) { SharedPreferences sp = context.getSharedPreferences("configdata", Context.MODE_PRIVATE); sp.edit().putLong(key, value).commit(); }
From source file:Main.java
public static boolean saveRegistrationId(Context context, String registration_id) { SharedPreferences prefs = getSharedPreference(context); Editor editor = prefs.edit(); editor.putString(REGISTRATION_ID, registration_id); return editor.commit(); }
From source file:Main.java
public static void putString(Context context, String key, String value) { SharedPreferences sp = context.getSharedPreferences("atguigu", Context.MODE_PRIVATE); sp.edit().putString(key, value).commit(); }