List of usage examples for android.content Context getSharedPreferences
public abstract SharedPreferences getSharedPreferences(File file, @PreferencesMode int mode);
From source file:Main.java
public static void cacheOnlyDestop(Context context, boolean onlyDestop) { SharedPreferences sp = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE); sp.edit().putBoolean(KEY_ONLY_DESTOP, onlyDestop).commit(); }
From source file:Main.java
public static String getUserKey(Context context) { SharedPreferences settings = context.getSharedPreferences(BCB_UPDATES_SHARED_PREF, Context.MODE_PRIVATE); return settings.getString(BCB_USER_KEY, null); }
From source file:Main.java
public static void setTextSizePrefs(Context context, String key, int value) { SharedPreferences sp = context.getSharedPreferences(PRE_NAME, Context.MODE_PRIVATE); sp.edit().putInt(key, value).commit(); }
From source file:Main.java
public static void saveBoolean(Context context, String key, boolean value) { Editor editor = context.getSharedPreferences(SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE).edit(); editor.putBoolean(key, value);//from www. j av a 2 s .c o m editor.commit(); }
From source file:Main.java
public static void putCount(Context context, int count) { SharedPreferences preferences = context.getSharedPreferences(DOWN_COUNT, Context.MODE_PRIVATE); preferences.edit().putInt(DOWN_COUNT_KEY, count).commit(); }
From source file:Main.java
public static String getThemePackageName(Context context, String default_theme) { SharedPreferences sp = context.getSharedPreferences(ALMOSTNEXUS_PREFERENCES, Context.MODE_PRIVATE); return sp.getString("themePackageName", default_theme); }
From source file:Main.java
public static void setChatBg(Context context, String key, String url) { SharedPreferences spf = context.getSharedPreferences("chat", Context.MODE_PRIVATE); spf.edit().putString(key, url).commit(); }
From source file:Main.java
/** * Method to set the new assumed Mode of the active session * //from www . j av a 2 s . c om * @param context * @param mode The new assumed Mode of the active session */ public static void setActiveSessionMode(Context context, int mode) { SharedPreferences prefs = context.getSharedPreferences(context.getPackageName(), Context.MODE_PRIVATE); prefs.edit().putInt(PREFS_KEY_MODE, mode).commit(); }
From source file:Main.java
public static void storeDistanceTravelled(Context context, int distance) { SharedPreferences sharedPref = context.getSharedPreferences("Distance", Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); editor.putInt("distance", distance); editor.apply();/* w w w . j a va 2 s .co m*/ }
From source file:Main.java
public static void setBoolean(Context ctx, String key, boolean value) { SharedPreferences spf = ctx.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); spf.edit().putBoolean(key, value).apply(); }