Skip to content

Save Object

Hendra Permana edited this page May 6, 2017 · 1 revision

Save from (Gson) object

.saveObject(object)

Example :

Profile mProfile = new Gson().fromJson(jsonObjectString, Profile.class);
gsonSharedPreferences.saveObject(mProfile);

Save from JSON object

.saveObject(jsonObject);

Example :

jsonObject = new JSONObject(jsonObjectString);
gsonSharedPreferences.saveObject(jsonObject);

Save from JSON string

.saveObject(jsonObjectString)

Example :

  • jsonObjectString :
{
   "user_id": 667,
   "user_name": "blog",
   "website": "http://blog.hynra.com"
}
  • code :
gsonSharedPreferences.saveObject(jsonObjectString);
Clone this wiki locally