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 getCleanTagsBoolean(Context context) { SharedPreferences sharedPreferences = context.getSharedPreferences(CleanTagsBoolean, Context.MODE_PRIVATE); return sharedPreferences.getBoolean(CleanTagsBoolean_K, false); }
From source file:Main.java
public static void setCurrentAppCatalog(Context context, int group) { SharedPreferences sp = context.getSharedPreferences(ALMOSTNEXUS_PREFERENCES, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sp.edit(); editor.putInt("currentAppCatalog", group); editor.commit();// w ww .j ava 2 s.c o m }
From source file:Main.java
public static boolean getPermissionBoolean(Context context) { SharedPreferences sharedPreferences = context.getSharedPreferences(PermissionBoolean, Context.MODE_PRIVATE); return sharedPreferences.getBoolean(PermissionBoolean_K, false); }
From source file:com.example.root.ailight.Constants.java
public static void saveInfo(JSONObject info, Context cnt) { cnt.getSharedPreferences(PREFER_NAME, cnt.MODE_PRIVATE).edit().putString(PREFER_INFO_KEY, info.toString()) .commit();/* w ww . ja v a2s. com*/ }
From source file:Main.java
public static SharedPreferences getTutorialPreferences(Context ctx) { SharedPreferences out = ctx.getSharedPreferences(TUT_PREFS, Context.MODE_PRIVATE); return out;//ww w . j a v a2 s . co m }
From source file:Main.java
public static String getPreference(Context context, String key) { SharedPreferences prefs = context.getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE); String value = prefs.getString(key, ""); return value; }
From source file:Main.java
/** * @param artistName/*from w w w . j av a 2 s. co m*/ * @param id * @param key * @param context */ public static void setArtistId(String artistName, long id, String key, Context context) { SharedPreferences settings = context.getSharedPreferences(key, 0); SharedPreferences.Editor editor = settings.edit(); editor.putLong(artistName, id); editor.commit(); }
From source file:Main.java
static public void removePreferences(Context context, String key) { SharedPreferences pref = context.getSharedPreferences("pref", Context.MODE_PRIVATE); SharedPreferences.Editor editor = pref.edit(); editor.remove(key);/* ww w . j a v a2s . com*/ editor.commit(); }
From source file:Main.java
public static SharedPreferences init(Context context) { if (sp == null) { sp = context.getSharedPreferences(PERF_NAME, Context.MODE_PRIVATE); }// w w w. j a v a 2s .co m return sp; }
From source file:Main.java
public static boolean isUserLoggedIn(Context context) { SharedPreferences sharedPreferences = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); return sharedPreferences.getBoolean(USER_LOGGED_IN, false); }