How to use Intent putExtra JSON data on android -
recently, in web server, json text, i'm using asynctask
string strdata = ""; @override protected void onpostexecute(string result) { super.onpostexecute(result); final arrayadapter<string> adapter = new arrayadapter<string>(mainactivity.this, android.r.layout.simple_list_item_1); try { jsonarray arr =new jsonarray(result); jsonobject ob = arr.getjsonobject(0); strdata += ob.getstring("name") + "\n" + " - " + ob.getstring("school") + "\n" + " - " + ob.getstring("job") + "\n\n"; adapter.add(strdata); } catch (jsonexception e) { log.d(tag,"dd"); } listview listview = (listview) findviewbyid(r.id.listview); listview.setadapter(adapter); }
result
aaa - seoul university - teacher
and want json parser value use intent.putextra
activity.
i don't know
intent intent = new intent(this, anotheractivity.class); intent.putextra("information","i don't know here"); startactivity(intent);
i want school.job
data activity transport.
how use data transport json parser data?
parse json inside object of same structure, pass object intent
university uni = new university(); uni.settitle(jsonobj.getjsonobject("title").opt("val").tostring()); intent = new intent(this, anotheractivity.class); i.putextra("information", uni);
then can object intent in other activity
Comments
Post a Comment