Merge 2 Adapter , and show it in one listview android -
i'm looking way merge 2 adapters 1 listview
, code show 2 adapter in 2 listview
, there possibility merge ?
not_choose.clear(); arraylist<dec_all> = this.notchoose(); (int = 0; < a.size(); i++) { int tidno = a.get(i).getid(); string name = a.get(i).getname(); dec_all cnt = new dec_all(); cnt.setid(tidno); cnt.setname(name); not_choose.add(cnt); } dbhandler.close(); gtpadapter = new not_chooseadapter(this, r.layout.not_choose_listrow, not_choose); i_choose.clear(); arraylist<dec_all> b = this.ichoose(); (int = 0; < b.size(); i++) { int tidno = b.get(i).getid(); string name = b.get(i).getname(); dec_all cnt = new dec_all(); cnt.setid(tidno); cnt.setname(name); i_choose.add(cnt); } dbhandler.close(); gtadapter = new i_chooseadapter(this, r.layout.i_choose_listrow, i_choose); lvdata_one.setadapter(gtadapter); //listview 1 lvdata_two.setadapter(gtpadapter); //list view 2
thanks advice
combine 2 array list one:
list<string> lista = new arraylist<string>(); lista.add("a"); list<string> listb = new arraylist<string>(); listb.add("b"); list<string> listfinal = new arraylist<string>(); listfinal.addall(lista); listfinal.addall(listb);
or can append listb :
listb.addall(lista);
Comments
Post a Comment