Skip to content

Get Object

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

Get Object

  • .getObject(object)
try {
    Profile profile = (Profile) gsonSharedPreferences.getObject(new Profile());
    Log.i(TAG, profile.getUserName());
    } catch (ParsingException e) {
         e.printStackTrace();
    }

Get Json Object

  • .getJsonObject(object)
try {
    JSONObject object = gsonSharedPreferences.getJsonObject(new Profile());
    } catch (ParsingException e) {
         e.printStackTrace();
    }

Get Json Object String

  • . getJsonObjectString(object)
try {
    Log.i(TAG, gsonSharedPreferences.getJsonObjectString(new Profile()));
    } catch (ParsingException e) {
         e.printStackTrace();
    }
Clone this wiki locally