java - Android AsyncTask with JSON Parsing error -
error coming in section:
protected void onpostexecute(jsonobject json) { try { // getting json array user = json.getjsonarray(tag_user); jsonobject c = json.getjsonobject(0); string id = c.getstring(tag_id); string name = c.getstring(tag_name); log.i("id",id); } }
------- webservice result---
{"getdataresult":{"id":8,"name":"foo bar"}} working link - http://127.0.0.1/wcfservice4/service1.svc/getdata/?key=8
provide better solution solving this.
it seems havn't use jsonarray object
jsonarray mainfoodlist = null; tipshealth = json.getjsonarray(tag_response); // looping through response (int = 0; < tipshealth.length(); i++) { jsonobject jsonobj = tipshealth.getjsonobject(i); tiphealth = jsonobj.getstring(key_healthtips); listhealthtips.add(tipshealth.getjsonobject(i).getstring("tips")); }
Comments
Post a Comment