List of usage examples for android.content SharedPreferences edit
Editor edit();
From source file:Main.java
public static void resetStartServiceFlag(Context context) { SharedPreferences sp = context.getSharedPreferences("you_notification", Activity.MODE_PRIVATE); sp.edit().putString(AUTO_STATE_FLAG, "1").commit(); }
From source file:Main.java
public static void setClearDefualtFlag(Context context, String flag) { SharedPreferences sp = context.getSharedPreferences("you_notification", Activity.MODE_PRIVATE); sp.edit().putString(CLEAR_AUTO_FLAG, flag).commit(); }
From source file:Main.java
public static void setCredentials(final Context context, String login, String password) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); sp.edit().putString(PREF_SAVED_LOGIN, login).putString(PREF_SAVED_PASSWORD, password).commit(); }
From source file:Main.java
public static void putString(Context context, String key, String values) { SharedPreferences sharedPreferences = context.getSharedPreferences("atguigu", Context.MODE_PRIVATE); sharedPreferences.edit().putString(key, values).commit(); }
From source file:Main.java
public static void setAttendeeAtVenue(final Context context, final boolean isAtVenue) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); sp.edit().putBoolean(PREF_ATTENDEE_AT_VENUE, isAtVenue).commit(); }
From source file:Main.java
public static void putString(Context context, String key, String values) { SharedPreferences sharedPreferences = context.getSharedPreferences("atqiye", Context.MODE_PRIVATE); sharedPreferences.edit().putString(key, values).commit(); }
From source file:Main.java
public static void deleteAllPreference(Context context) { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); Editor edit = pref.edit(); edit.clear();/* w w w. j a va2 s . com*/ edit.commit(); }
From source file:Main.java
public static void setPreference(Context context, String key, Object value) { SharedPreferences pref = getPreferences(context); Editor editor = pref.edit(); if (value instanceof Boolean) { editor.putBoolean(key, (Boolean) value); } else if (value instanceof Float) { editor.putFloat(key, (Float) value); } else if (value instanceof Integer) { editor.putInt(key, (Integer) value); } else if (value instanceof Long) { editor.putLong(key, (Long) value); } else if (value instanceof String) { editor.putString(key, (String) value); } else {/* www.ja v a2 s .c o m*/ editor.putString(key, value.toString()); } editor.commit(); }
From source file:Main.java
public static void putValue(Context context, String value) { SharedPreferences spf = context.getSharedPreferences("md5", Context.MODE_PRIVATE); Editor edit = spf.edit(); edit.putString("sha", value); edit.commit();/*w ww . j a v a2 s .c om*/ }
From source file:Main.java
private static SharedPreferences.Editor getEditor(Context context) { SharedPreferences sharedPrefs = getSharedPreferences(context); return sharedPrefs.edit(); }