expandablelistview - Collapse all group except selected group in expandable listview android -


i'm developing android application using expandable list view. need is, i'm listing group, contains child.

if select unexpandable group, should expand, after ll select second group @ time first group should collapsed. did google, couldn't find want. please me out.

have current expanded group position stored in variable. in ongroupexpanded following.

private int lastexpandedposition = -1; private expandablelistview lv; //your expandable listview ...  lv.setongroupexpandlistener(new ongroupexpandlistener() {      @override     public void ongroupexpand(int groupposition) {             if (lastexpandedposition != -1                     && groupposition != lastexpandedposition) {                 lv.collapsegroup(lastexpandedposition);             }             lastexpandedposition = groupposition;     } }); 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -