Reputation: 28344
I am first time developing an android app. Very new to this. I have the application compiled and when I hit run on eclipse, I am expecting to see the log message but it never shows there
try {
JSONArray jArray = new JSONArray(result);
for(int i=0; i<jArray.length(); i++) {
// JSONObject json_data = jArray.getJSONObject(i);
JSONObject json_data = jArray.getJSONObject(i);
Log.i("log_tag","id: "+json_data.getInt("id")+
", name: "+json_data.getString("name")+
", sex: "+json_data.getInt("sex")+
", birthyear: "+json_data.getInt("birthyear"));
//Get an output to the screen
returnString += "\n\t" + jArray.getJSONObject(i);
}
using log.i.
Upvotes: 0
Views: 170
Reputation: 4427
Click DDMS and make sure the emulator you're running is selected. And make sure you're on the LogCat tab. you can also search for "app: com.your.app.package"
just to make sure your message isn't messed up you might try doing something like Log.d("tag", "test"); Also i assume you've imported android.util.Log; since it compiles.
also maybe do something like
if(jArray != null) { Log.i("","not null"); } else { Log.i("", "null"); }
right before your for loop
Upvotes: 3