Created
July 3, 2013 13:26
-
-
Save damianflannery/5917828 to your computer and use it in GitHub Desktop.
Preferences.putStringSet() does not exist in Gingerbread so you can use this class below as a substitute if you need to target below Android v3.0 (Honeycomb)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Below, the code to use putStringSet is commented out. Alternative JSONSharedPreferences is used instead | |
//Set<String> trainers = new TreeSet<String>(); | |
JSONArray jTrainers = new JSONArray(); | |
List<FilteredWorkoutVideo> videos = getAllFilteredVideos(prefs); | |
for (FilteredWorkoutVideo video : videos) { | |
//trainers.add(video.getTrainerName()); | |
jTrainers.put(video.getTrainerName()); | |
} | |
//e = prefs.edit(); | |
//e.putStringSet(Constants.KEY_ALL_TRAINERS, trainers); | |
//e.apply(); | |
JSONSharedPreferences.saveJSONArray(prefs, Constants.KEY_ALL_TRAINERS, jTrainers); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment