List of usage examples for android.preference PreferenceManager getDefaultSharedPreferences
public static SharedPreferences getDefaultSharedPreferences(Context context)
From source file:Main.java
public static String fetchStringSharePref(Context context, String key, String defaultValue) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); return preferences.getString(key, defaultValue); }
From source file:Main.java
public static long getLastSync(Context context) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); return prefs.getLong(LASTSYNC_PARAM, 0); }
From source file:Main.java
public static boolean getPrefDisplayLineNumber(final Context context) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); return sp.getBoolean(PREF_DISPLAY_LINE_NUMBER, true); }
From source file:Main.java
public static SharedPreferences getSharedPreferences(Context context) { if (preferences == null) { preferences = PreferenceManager.getDefaultSharedPreferences(context); }/*from w ww . j a va2s.com*/ return preferences; }
From source file:Main.java
public static int getLastForumPageSaved(Context context) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); int forumPageNum = prefs.getInt(PREF_LAST_FORUM_PAGE_SAVED, -1); return forumPageNum; }
From source file:Main.java
public static boolean setLastPatchLastModifiedTime(Context context, long time) { return PreferenceManager.getDefaultSharedPreferences(context).edit() .putLong(PATCH_LAST_MODIFIED_TIME_KEY, time).commit(); }
From source file:Main.java
public static String getDefaultRingtone(Context context, int type) { SharedPreferences mSharePref = PreferenceManager.getDefaultSharedPreferences(context); String value = mSharePref.getString(TYPE_SYSTEM_PRIMER + type, ""); return value; }
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 setBrowseMoviesMode(final Context context, String mode) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); sp.edit().putString(PREF_BROWSE_MOVIES_MODE, mode).apply(); }
From source file:Main.java
public static boolean loadPrefBoolean(Context context, String key, boolean defaultValue) { if (pref == null) { pref = PreferenceManager.getDefaultSharedPreferences(context); }//from w ww. java2s.c o m return pref.getBoolean(key, defaultValue); }