eror when parsing json android no data when run -
this code how use load data json..
client.get(url, new jsonhttpresponsehandler() { @override public void onsuccess(int statuscode, header[] headers, jsonobject obj) { try { if (!obj.getboolean("error")) { jsonarray cest = obj.getjsonarray("list"); string z = ""; if (cest != null) { int array = cest.length(); mdetail = new arraylist<orderitem>(); simpledateformat formatter = new simpledateformat("yyyy-mm-dd hh:mm:ss"); date dateorder = new date(); (int = 0; < array; i++) { try { dateorder = formatter.parse(cest.getjsonobject(i).getstring("orderdate")); } catch (parseexception e) {} mdetail.add(new orderdetailsinfo(uuid.fromstring(cest.getjsonobject(i).getstring("orderid")) , dateorder, cest.getjsonobject(i).getstring("brancid"), cest.getjsonobject(i).getstring("dcbranchid"), cest.getjsonobject(i).getstring("orderdocno"), cest.getjsonobject(i).getstring("subdealerid"), cest.getjsonobject(i).getstring("docorderno"), cest.getjsonobject(i).getstring("orderdocnoalt"), cest.getjsonobject(i).getstring("saleschannelid"), cest.getjsonobject(i).getstring("marketingprogramid"), cest.getjsonobject(i).getstring("mdmarketingprogramid"), cest.getjsonobject(i).getstring("pricelistid"))); } orderdetailsadapter adapter = new orderdetailsadapter(getactivity(), mdetail); setlistadapter(adapter); adapter.notifydatasetchanged(); toast.maketext(getactivity().getapplicationcontext(), "refreshed: " + cest.length(), toast.length_long).show(); } //if (cast != null) { } //if (!obj.getboolean("error")) { } catch (jsonexception e) { } } @override public void onfailure(int statuscode, header[] headers, throwable e, jsonobject errorresponse) { // called when response http status "4xx" (eg. 401, 403, 404) // probable causes: no internet permission, no internet connection toast.maketext(getactivity().getapplicationcontext(), "error: onfailure: " + e.tostring(), toast.length_long).show(); } }); }
when run there no eror data cannot load..
what wrong code.?
somebody please me..
Comments
Post a Comment