Skip to content Skip to sidebar Skip to footer

Getting Error In Gson Deserializing Using Android Studio

I am working on an application in which I am using android phone contacts in my application.So, for that first of all fetch contact details and store it into ArrayList. After that

Solution 1:

it is really hard to answer without the json response you are getting but from the error you have i can tell the following code will help you

Updated the answer

publicArrayList<Contact> deserializer(String jsonString){

    //Type collectionType = new TypeToken<Collection<Contact>>(){}.getType();//  Collection<Contact> enums = gson.fromJson(jsonString, collectionType);ArrayList<Contact> contactsList =  (newGson()).fromJson(jsonString,newTypeToken<ArrayList<Contact>>() {}.getType());

    return contactsList;
}

following are some example that might help you with Gson library

ExampleOne

ExampleTwo

Post a Comment for "Getting Error In Gson Deserializing Using Android Studio"