List of usage examples for android.content SharedPreferences edit
Editor edit();
From source file:Main.java
public static void editInfo(Context context, String userName, String userId, String userIcon, String userPwd) { SharedPreferences preferences = context.getSharedPreferences(USER_INFO, Context.MODE_PRIVATE); preferences.edit().putString(USER_NAME, userName).putString(USER_ICON, userIcon).putString(USER_ID, userId) .putString(USER_PWD, userPwd).commit(); }
From source file:Main.java
/** * * @param context//from w ww . j av a 2s.c o m * @param key * @param values */ public static void putString(Context context, String key, String values) { SharedPreferences sharedPreferences = context.getSharedPreferences("7Yan", Context.MODE_PRIVATE); sharedPreferences.edit().putString(key, values).commit(); }
From source file:Main.java
public static void setGuided(Context context) { SharedPreferences prefe = context.getSharedPreferences(USER_GUIDE_FILE_NAME, 0); Editor editor = prefe.edit(); editor.putBoolean("isguide", true); editor.commit();/*from w w w. j av a 2 s .co m*/ }
From source file:Main.java
public static void markUserRefusedSignIn(final Context context, final boolean refused) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); sp.edit().putBoolean(PREF_USER_REFUSED_SIGN_IN, refused).commit(); }
From source file:Main.java
public static void setGuided(Context context) { SharedPreferences pref = context.getSharedPreferences(context.getPackageName() + "_preferences", 0); pref.edit().putBoolean(IS_GUIDED, true).commit(); }
From source file:Main.java
@SuppressLint("DefaultLocale") public static void SaveLastWallpaperDate(Context context, Calendar dateTime) { int year = dateTime.get(Calendar.YEAR); int month = dateTime.get(Calendar.MONTH); int date = dateTime.get(Calendar.DATE); String dateTimeToString = String.format("%d/%d/%d", year, month, date); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); preferences.edit().putString("wallpaper_date", dateTimeToString).commit(); }
From source file:Main.java
public static void enable(final SharedPreferences pref, final String id) { final SharedPreferences.Editor editor = pref.edit(); editor.putBoolean(id, true);/*from ww w. jav a2 s .c o m*/ editor.apply(); }
From source file:Main.java
public static void putboolean(Context context, String key, boolean vauels) { SharedPreferences sharedPreferences = context.getSharedPreferences(SPACENAMA, context.MODE_PRIVATE); sharedPreferences.edit().putBoolean(key, vauels).commit(); }
From source file:Main.java
public static void setLatestForumPostSaved(Context context, String forumPostUrl) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); Editor edit = prefs.edit(); edit.putString(PREF_LATEST_FORUM_POST, forumPostUrl); edit.commit();/*from ww w.ja v a 2s . com*/ }
From source file:Main.java
private static void saveCloseCount(Context c, String prefName, int closeCount) { SharedPreferences settings = c.getSharedPreferences(prefName, 0); SharedPreferences.Editor editor = settings.edit(); editor.putInt("closeCount", closeCount); editor.commit();//w w w. java 2 s . com }