List of usage examples for android.content SharedPreferences getStringSet
@Nullable Set<String> getStringSet(String key, @Nullable Set<String> defValues);
From source file:Main.java
public static Set<String> getStringSet(Context context, String key, Set<String> defValues) { SharedPreferences sp = getSharedPreferences(context); return sp.getStringSet(key, defValues); }
From source file:Main.java
public static Set<String> getStringSetProperty(Context context, String key, String fileName) { SharedPreferences sp = context.getSharedPreferences(fileName, Context.MODE_PRIVATE); return sp.getStringSet(key, new HashSet<String>()); }
From source file:Main.java
public static void removeFromFavorites(final Context context, long movieId) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); Set<String> set = sp.getStringSet(PREF_FAVORED_MOVIES, null); if (set == null) set = new HashSet<>(); set.remove(String.valueOf(movieId)); sp.edit().putStringSet(PREF_FAVORED_MOVIES, set).apply(); }
From source file:Main.java
public static void addToFavorites(final Context context, long movieId) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); Set<String> set = sp.getStringSet(PREF_FAVORED_MOVIES, null); if (set == null) set = new HashSet<>(); set.add(String.valueOf(movieId)); sp.edit().putStringSet(PREF_FAVORED_MOVIES, set).apply(); }
From source file:Main.java
public static Set<String> getStringSet(Context mContext, String key) { SharedPreferences pref = mContext.getSharedPreferences(AIO_SHARE_PREFS, Context.MODE_MULTI_PROCESS); return pref.getStringSet(key, null); }
From source file:Main.java
public static Set<String> getStringSetProperty(Context context, String key) { SharedPreferences sp = context.getSharedPreferences(DEFAULT_FILE_NAME, Context.MODE_PRIVATE); return sp.getStringSet(key, null); }
From source file:Main.java
public static Set<String> getAllFaceIds(String personId, Context context) { SharedPreferences faceIdSet = context.getSharedPreferences(personId + "FaceIdSet", Context.MODE_PRIVATE); return faceIdSet.getStringSet("FaceIdSet", new HashSet<String>()); }
From source file:Main.java
public static void logOutUser(Context context, String userId) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); Set<String> currentUsers = prefs.getStringSet(LOGGED_IN_USER_PREFERENCE_KEY, new HashSet<>()); currentUsers.remove(userId);//from w w w . j a v a2s . c o m PreferenceManager.getDefaultSharedPreferences(context).edit() .putStringSet(LOGGED_IN_USER_PREFERENCE_KEY, currentUsers).commit(); }
From source file:Main.java
public static Set<String> getAllPersonGroupIds(Context context) { SharedPreferences personGroupIdSet = context.getSharedPreferences("PersonGroupIdSet", Context.MODE_PRIVATE); return personGroupIdSet.getStringSet("PersonGroupIdSet", new HashSet<String>()); }
From source file:Main.java
public static Set<String> getAllPersonIds(String personGroupId, Context context) { SharedPreferences personIdSet = context.getSharedPreferences(personGroupId + "PersonIdSet", Context.MODE_PRIVATE); return personIdSet.getStringSet("PersonIdSet", new HashSet<String>()); }