I'm trying to print out an object in the JSON
using Facebook Graph API.
Here's my code:
try{
JSONArray data = innerJson.getJSONArray("data");
Log.d("innerDataLength", String.valueOf(data.length()));
for (int i = 0; i<data.length(); i++) {
String message = data.getJSONObject(i).getString("message");
Log.d("message", message);
}
} catch (JSONException e) {
Log.d("exception", e.getMessage());
}
Here's output:
D/innerDataLength: 25
D/message: "blah blah blah"
D/exception: No value for message
As you can see the condition
i.e. data.length()
is 25 then why am I getting the message printed out only once?