List of usage examples for android.content SharedPreferences edit
Editor edit();
From source file:Main.java
public static void setInt(Context ctx, String key, int value) { SharedPreferences sp = ctx.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); sp.edit().putInt(key, value).apply(); }
From source file:Main.java
public static void setUserChapter(final Context context, final String chapter) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); sp.edit().putString(PREF_CHAPTER, chapter).commit(); }
From source file:Main.java
public static void setInt(Context ctx, String key, int value) { SharedPreferences sp = ctx.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); sp.edit().putInt(key, value).commit(); }
From source file:Main.java
public static void setUserDOB(final Context context, final String dob) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); sp.edit().putString(PREF_DOB, dob).commit(); }
From source file:Main.java
public static void setUserId(final Context context, final String userId) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); sp.edit().putString(PREF_ID, userId).commit(); }
From source file:Main.java
public static void setUserPhoneNumber(final Context context, final String phone) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); sp.edit().putString(PREF_PHONE_NUMBER, phone).commit(); }
From source file:Main.java
public static void setUserGender(final Context context, final String gender) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); sp.edit().putString(PREF_GENDER, gender).commit(); }
From source file:Main.java
public static void setPhoneNumber(final Context context, final String phoneNumber) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); sp.edit().putString(PREF_PHONE_NUMBER_1, phoneNumber).apply(); }
From source file:Main.java
public static void writeToPrefs(Context context, String key, String value) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); prefs.edit().putString(key, value).apply(); }
From source file:Main.java
public static SharedPreferences.Editor writeSharedPref(Context context, String sharedPref) { SharedPreferences settings = context.getSharedPreferences(sharedPref, 0); return settings.edit(); }