private SharedPreferences preferences;
private SharedPreferences.Editor editor;
//Save objects
preferences = context.getSharedPreferences(namePreferences, mode);
editor = preferences.edit();
editor.putString(key, GSON.toJson(object));
editor.commit();
//Retrieve objects
String gson = preferences.getString(key, null);
Object o = GSON.fromJson(gson, a);
No comments:
Post a Comment