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 boolean getBoolean(String key, boolean defValue, Context ctx) { SharedPreferences sp = ctx.getSharedPreferences("config", Context.MODE_PRIVATE); return sp.getBoolean(key, defValue); }
From source file:Main.java
public static String getString(String key, String defValue, Context ctx) { SharedPreferences sp = ctx.getSharedPreferences("config", Context.MODE_PRIVATE); return sp.getString(key, defValue); }
From source file:Main.java
private static SharedPreferences getSharedPreferences(final Context context) { return context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); }
From source file:Main.java
public static Boolean getBoolean(Context context, String key) { sp = context.getSharedPreferences(name, Context.MODE_PRIVATE); return sp.getBoolean(key, false); }
From source file:Main.java
private static SharedPreferences getSharedPreferences(Context context) { return context.getSharedPreferences("NightModeDemo", Context.MODE_APPEND); }
From source file:Main.java
public static String recuperarValores(Context context, String chave) { return context.getSharedPreferences(PREFERENCES, 0).getString(chave, null); }
From source file:Main.java
public static SharedPreferences getSharedPreferences(Context context, String name) { return context.getSharedPreferences(name, Context.MODE_PRIVATE); }
From source file:Main.java
private static void loadSharedPreferences(Context context) { mPreferences = context.getSharedPreferences(CONFIG_NAME, Context.MODE_PRIVATE); }
From source file:Main.java
public static void setUserLoggedIn(Context context) { Editor edit = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE).edit(); edit.putBoolean(USER_LOGGED_IN, true); edit.commit();/*from ww w. jav a 2 s . com*/ }
From source file:Main.java
public static void setUserLoggedOut(Context context) { Editor edit = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE).edit(); edit.putBoolean(USER_LOGGED_IN, false); edit.commit();/*from ww w.j a v a2 s . co m*/ }