web services - How to Edit And Delete the Searched Data From JSON WebService Using Android -
i have searching data in listview webservice using json android, want modify , delete searched data. how put coding that? please me.
// searching data webservice , binding in listview // private class jsonparse extends asynctask<string, string, jsonobject> { private progressdialog pdialog; @override protected void onpreexecute() { super.onpreexecute(); datetime = (textview)findviewbyid(r.id.textview1); status = (textview)findviewbyid(r.id.textview2); jobno = (edittext) findviewbyid(r.id.add_jobno); pdialog = new progressdialog(add_update_user.this); pdialog.setmessage("processing please wait ..."); pdialog.setindeterminate(false); pdialog.setcancelable(true); pdialog.show(); } @override protected jsonobject doinbackground(string... args) { jsonparser jparser = new jsonparser(); string flag="s" ; arraylist<basicnamevaluepair> params = new arraylist<basicnamevaluepair>(); params.clear(); params.add(new basicnamevaluepair("jobno",jobno.gettext().tostring())); params.add(new basicnamevaluepair("flag",flag)); //getting json url jsonobject json = jparser.getjsonfromurl(url,params); return json; } protected void onpostexecute(jsonobject json) { pdialog.dismiss(); try { if (jobno.gettext().tostring().equals("") ) { toast.maketext(add_update_user.this, "the field should not null", toast.length_short).show(); } else { // getting json array url cargo = json.getjsonarray(tag_cargotrack); for(int = 0; < cargo.length(); i++){ jsonobject c = cargo.getjsonobject(i); string jobno = c.getstring(tag_jobno); string status = c.getstring(tag_status); string datetime = c.getstring(tag_datetime); // adding value hashmap key => value hashmap<string, string> map = new hashmap<string, string>(); map.put(tag_jobno, jobno); map.put(tag_status, status); map.put(tag_datetime, datetime); cargotracklist.add(map); list=(listview)findviewbyid(r.id.listview1); //simpleadapter adapter = new simpleadapter(add_update_user.this, cargotracklist, listadapter adapter = new simpleadapter(add_update_user.this, cargotracklist, r.layout.listview_row, new string[] { tag_jobno,tag_status, tag_datetime }, new int[] { r.id.user_jobno_txt,r.id.user_status_txt, r.id.user_date_time_txt }); list.setadapter(adapter); button1.setonclicklistener(new view.onclicklistener() { simpleadapter adapter; @override public void onclick(view view) { list.setadapter(null); cargotracklist.clear(); if(adapter != null){ adapter.notifydatasetchanged(); } new jsonparse().execute(); } }); } } } catch (exception e) { toast.maketext(getapplicationcontext(), "not connected internet",toast.length_long).show(); e.printstacktrace(); } } }
Comments
Post a Comment