List of usage examples for android.preference PreferenceManager getDefaultSharedPreferences
public static SharedPreferences getDefaultSharedPreferences(Context context)
From source file:Main.java
public static Map<String, ?> getAll(Context context) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); Map<String, ?> prefsMap = preferences.getAll(); return prefsMap; }
From source file:Main.java
public static void putInt(final Context context, final String key, final int value) { if (context != null) { final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context); final SharedPreferences.Editor editor = settings.edit(); editor.putInt(key, value).apply(); }/*from w ww. ja v a 2 s .co m*/ }
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 String getUserPhoneNumber(final Context context) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); return sp.getString(PREF_PHONE_NUMBER, null); }
From source file:Main.java
public static String getDefaults(String key, Context context) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); return preferences.getString(key, "false"); }
From source file:Main.java
protected static void initialize(Context context) { sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); }
From source file:Main.java
public static String getPreference(Context context, String key, String defaultValue) { SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context); return settings.getString(key, defaultValue); }
From source file:Main.java
public static long getCanelNotificationTime(Context context) { long time = 0; if (context != null) { SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context); time = settings.getLong("cancel_time", System.currentTimeMillis()); }//from w w w.j a v a2 s .com return time; }
From source file:Main.java
public static void setPrefFontSize(final Context context, float size) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); sp.edit().putFloat(PREF_FONT_SIZE, size).commit(); }
From source file:Main.java
public static void putLong(final Context context, final String key, final long value) { if (context != null) { final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context); final SharedPreferences.Editor editor = settings.edit(); editor.putLong(key, value).apply(); }//from w w w . java2 s . co m }