List of usage examples for android.content SharedPreferences edit
Editor edit();
From source file:Main.java
public static void setBooleanSharedPreferences(Context context, String name, String key, boolean value) { SharedPreferences preferences = context.getSharedPreferences(name, 0); SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean(key, value);/*from www . ja va 2 s . c o m*/ editor.commit(); }
From source file:Main.java
public static void setNonWiFiTime(long time, Context context) { SharedPreferences sp = context.getSharedPreferences(PREFS_CACHE_ONE, 0); SharedPreferences.Editor editor = sp.edit(); editor.putLong("nonWiFiTime", time); editor.commit();/*from w w w . j a v a2 s . c om*/ }
From source file:Main.java
public static void setGetDooiooAllTime(long time, Context context) { SharedPreferences sp = context.getSharedPreferences(PREFS_CACHE_ONE, 0); SharedPreferences.Editor editor = sp.edit(); editor.putLong("getDooiooAllTime", time); editor.commit();/*from w ww . j av a 2 s . c om*/ }
From source file:Main.java
public static void setDecodingType(Context context, boolean isFFMpeg) { if (context != null) { SharedPreferences sp = context.getSharedPreferences(PREFERENCES_DECODING_TYPE, Context.MODE_PRIVATE); sp.edit().putBoolean(KEY_DECODING_TYPE, isFFMpeg).commit(); }//from www. j a v a 2 s . c o m }
From source file:Main.java
public static void setWindowX(float x, Context context) { SharedPreferences sp = context.getSharedPreferences(PREFS_CACHE_ONE, 0); SharedPreferences.Editor editor = sp.edit(); editor.putFloat("x", x); editor.commit();// w ww . j ava 2 s. co m }
From source file:Main.java
public static void setEnableGprs(boolean isEnableGprs, Context context) { SharedPreferences sp = context.getSharedPreferences(PREFS_CACHE_ONE, 0); SharedPreferences.Editor editor = sp.edit(); editor.putBoolean("isEnableGprs", isEnableGprs); editor.commit();// w w w . ja v a2s . co m }
From source file:Main.java
/** * @param artistName/*from w ww .j a v a 2s . c om*/ * @param id * @param key * @param context */ public static void setArtistId(String artistName, long id, String key, Context context) { SharedPreferences settings = context.getSharedPreferences(key, 0); SharedPreferences.Editor editor = settings.edit(); editor.putLong(artistName, id); editor.commit(); }
From source file:Main.java
public static void saveDefaultRingtone(Context context, int type, String id) { SharedPreferences mSharePref = PreferenceManager.getDefaultSharedPreferences(context); Editor mEditor = mSharePref.edit(); mEditor.putString(TYPE_SYSTEM_PRIMER + type, id); mEditor.commit();/*from www .j ava 2 s .c o m*/ }
From source file:Main.java
private static void setAuthToken(final Context context, final String authToken) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); sp.edit().putString(PREF_AUTH_TOKEN, authToken).commit(); }
From source file:Main.java
public static void delete(Collection<String> keys) { SharedPreferences preferences = getPrivateSharedPreference(); SharedPreferences.Editor editor = preferences.edit(); for (String key : keys) { editor.remove(key);/*from ww w .j a v a 2 s . c om*/ } editor.commit(); }