Skip to content Skip to sidebar Skip to footer

Obtain Parameters Of A Jsonobject Within Another Jsonobject

try to get the url of an image, this is inside a JsonObject and that both also within other JsonObject this is the error that throws me 05-25 03:09:51.120 9573-9836/com.learn2cr

Solution 1:

Try this..

Instead of this..

JSONObject images = c.getJSONObject(TAG_THUM);
JSONObject fullurl = images.getJSONObject(TAG_THUM_FULL);
String thumbnail = fullurl.getString(TAG_THUM_FULL_URL);

add

JSONObject images = null;
String thumbnail = "";

if(c.has(TAG_THUM)){
   images = c.getJSONObject(TAG_THUM);
   JSONObject fullurl = images.getJSONObject(TAG_THUM_FULL);
   thumbnail = fullurl.getString(TAG_THUM_FULL_URL);
}

There is no thumbnail_images in first that only in second item so that No value for thumbnail_images use has for checking is available or not

Post a Comment for "Obtain Parameters Of A Jsonobject Within Another Jsonobject"