listview - Android how to append new data to a Custom base adapter -
i have custom base adapter extracts new data database on button click, works old data discarded , keep , append new data it. looking on example how append latest data custom base adapter list view in android? , seems incomplete, instance how can append new data old 1 without creating new object.
this area of code struggling with
@override protected void onpostexecute(string s) { super.onpostexecute(s); customview cv; try { listview lv = (listview) m.findviewbyid(r.id.mylistview); jsonobject jsonn = new jsonobject(result); jsonarray jarray = jsonn.getjsonarray("myarray"); jsonobject jobject = null; jsonarray sss = new jsonarray(); (int = 0; < jarray.length(); i++) { jobject = jarray.getjsonobject(i); jobject.getstring("message"); sss.put(jobject); } jsonn.put("myarray", sss); if(data==1) { cv = new customview(jsonn, m); dmf.notifydatasetchanged(); lv.setadapter(cv); } else { // new data should appended here cv = new customview(jsonn, m); dmf.notifydatasetchanged(); lv.setadapter(cv); } } catch (exception e) { log.e("jsonexception", "error: " + e.tostring()); system.err.println(); } }
i can not figure out how append new data , not create new object. data integer equal 1 on first pass , 2 on other pass. stated before can not seem figure how append on post stating how append latest data custom base adapter list view in android?
Comments
Post a Comment