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 keyExistsInSharedPreference(Context context, String key) { return context.getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE).contains(key); }
From source file:Main.java
/** * Reading from Preferences//ww w. j av a 2s . c om */ public static String readFromPrefsString(Context ctx, String key) { return ctx.getSharedPreferences(ctx.getApplicationInfo().packageName, ctx.MODE_PRIVATE).getString(key, ""); }
From source file:Main.java
public static int getInt(String key, int defValue, Context ctx) { SharedPreferences sp = ctx.getSharedPreferences("config", Context.MODE_PRIVATE); return sp.getInt(key, defValue); }
From source file:Main.java
public static SharedPreferences getPref(Context context, String name) { return context.getSharedPreferences(name, Context.MODE_PRIVATE); }
From source file:Main.java
static SharedPreferences getAccessTokenSharedPreference(final Context appContext) { return appContext.getSharedPreferences(ACCESS_TOKEN_SHARED_PREFERENCE, Activity.MODE_PRIVATE); }
From source file:Main.java
static SharedPreferences getRefreshTokenSharedPreference(final Context appContext) { return appContext.getSharedPreferences(REFRESH_TOKEN_SHARED_PREFERENCE, Activity.MODE_PRIVATE); }
From source file:Main.java
public static void remove(String key, Context ctx) { SharedPreferences sp = ctx.getSharedPreferences("config", Context.MODE_PRIVATE); sp.edit().remove(key).commit();//from w w w. j a va2 s.c o m }
From source file:Main.java
public static void putString(String key, String value, Context ctx) { SharedPreferences sp = ctx.getSharedPreferences("config", Context.MODE_PRIVATE); sp.edit().putString(key, value).commit(); }
From source file:Main.java
public static void putBoolean(String key, boolean value, Context ctx) { SharedPreferences sp = ctx.getSharedPreferences("config", Context.MODE_PRIVATE); sp.edit().putBoolean(key, value).commit(); }
From source file:Main.java
public static String getSharedPreferencesString(Context context, String key) { return context.getSharedPreferences(SP_FIRST_START, 0).getString(key, ""); }