Android query can't store class variable from json object callback -
i can't write class variable ajax-json callback. show right info inside callback when aquery callback finish, set null. why? code:
public void asyncjson() {
string url = "myurl"; aq.ajax(url, jsonobject.class, new ajaxcallback<jsonobject>() { @override public void callback(string url, jsonobject json, ajaxstatus status { if (json != null) { jsontostring(json); } else { toast.maketext(aq.getcontext(), "error:" + status.getcode(), toast.length_long).show(); } } }); private void jsontostring(jsonobject data) { jsonarray array = null; try { array = data.getjsonarray("listresp"); (int = 0; < array.length(); i++) { jsonobject json_data = array.getjsonobject(i); c.setdate_creation(json_data.getstring("date_creation")); c.setname_user(json_data.getstring("name_user")); list.add(c);//linkedlist } } catch (jsonexception e) { toast.maketext(getapplicationcontext(), e.getmessage(), toast.length_long).show(); } } the variable listcontest when callback finish null. can me? thankyou!
Comments
Post a Comment