Skip to content

Get Objects

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

Get Object Array

  • .getObjects(object)
try {
      Profile[] profiles = (Profile[]) gsonSharedPreferences.getObjects(new Profile());
      Log.i(TAG, profiles[1].getUserName());
    } catch (ParsingException e) {
         e.printStackTrace();
    }

Get Json Array

  • .getJsonArray(object)
try {
    JSONArray array = gsonSharedPreferences.getJsonArray(new Profile());
    } catch (ParsingException e) {
         e.printStackTrace();
    }

Get Json array String

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