android - Checkbox choice changed when listview expanded -


screenshot of checked 3 checkboxes

screenshot of automatically checked last checkbox

i checked first 3 checkbox on expandablelistview. why when expand listview last checkbox checked?

private arraylist<group_items> setalldata() {      string group_titles[] = {             "payment of employer , employees contribution",             "monthly return filing in form 5 , declaration in form 2",             "monthly return filing in form 10",             "monthly return filing in form 12",             "statement of recovery contractor",             "annual return in form 6a",             "renewal of contribution card of employee filing form 3 & 3a",             "submission of contribution card of employees leaving services" };      string child_info[] = {             "we have deployed secured web services framework in accordance oasis standards. please refer user manual (secured web service user manual) under section , necessary changes @ end start consuming same. existing web services shall discontinued w.e.f 1-dec-2015.",             "return of employees qualifying membership",             "return of members leaving services during month",             "statement of contribution",             "self explnatory",             "consolidated annual contribution statement",             "self explnatory",             "self explnatory" };      string dates[] = {             "15th of next month + 5 days grace period",             "15th of next month",             "15th of next month",             "25th of next month",             "7th of next month",             "30th april",             "within 1 month on expiry of contribution card currancy commissioner",             "20th of next month" };      arraylist<group_items> list = new arraylist<group_items>();     arraylist<child_items> ch_list= new arraylist<child_items>();     ch = new child_items();     int i=0;     int size=1;      (string group_title : group_titles) {         group_items gru = new group_items();          gru.setname(group_title);          ch_list = new arraylist<child_items>();         (; < size; i++) {             child_items ch = new child_items();              ch.setchild_title(child_info[i]);             ch.setdd("due date:");             ch.setdate(dates[i]);              ch_list.add(ch);         }          gru.setitems(ch_list);         list.add(gru);         size=size+1;     }     return list; } 

i have created expandablelistview checkbox beside each title , when checked first 3 or 4 checkbox 8 titles , first groupitem expanded automatically last (8th) checkbox checked.

this custom adapter code

public class mybaseexpandablelistadapter extends baseexpandablelistadapter{ context context; arraylist<group_items> group_al;  public mybaseexpandablelistadapter(context context,arraylist<group_items> group_al) {     this.context=context;     this.group_al=group_al; } @override public object getchild(int groupposition, int childposition) {     arraylist<child_items> chlist = group_al.get(groupposition).getitems();      return chlist.get(childposition); }  @override public long getchildid(int groupposition, int childposition) {      return childposition; }  @override public view getchildview(int groupposition, int childposition, boolean islastchild, view convertview,                          viewgroup parent) {     child_items ch = (child_items) getchild(groupposition, childposition);     if (convertview == null) {         layoutinflater infalinflater = (layoutinflater) context                 .getsystemservice(context.layout_inflater_service);         convertview = infalinflater.inflate(r.layout.expandable_child_items, null);     }     textview child = (textview) convertview.findviewbyid(r.id.child);     textview dd = (textview) convertview.findviewbyid(r.id.dd);     textview date= (textview) convertview.findviewbyid(r.id.date);      child.settext(ch.getchild_title().tostring());     dd.settext(ch.getdd().tostring());     date.settext(ch.getdate().tostring());      return convertview; }  @override public int getchildrencount(int groupposition) {     arraylist<child_items> chlist = group_al.get(groupposition).getitems();      return chlist.size(); }  @override public object getgroup(int groupposition) {      return group_al.get(groupposition); }  @override public int getgroupcount() {      return group_al.size(); }  @override public long getgroupid(int groupposition) {      return groupposition; }  @override public view getgroupview(int groupposition, boolean isexpanded, view convertview, viewgroup parent) {     group_items gr = (group_items) getgroup(groupposition);     long group_id = getgroupid(groupposition);      if (convertview == null) {         layoutinflater inf = (layoutinflater) context                 .getsystemservice(context.layout_inflater_service);         convertview = inf.inflate(r.layout.expandable_group_items, null);     }      textview title = (textview) convertview.findviewbyid(r.id.title);     title.settext(gr.getname());     checkbox chk=(checkbox) convertview.findviewbyid(r.id.chk);      return convertview; }  @override public boolean hasstableids() {      return true; }  @override public boolean ischildselectable(int arg0, int arg1) {      return false; }  } 


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -