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

html - Cut text on left side inside button while centering -

java - Last square of 8x8 grid not drawn, using two nested FOR loops -

What design pattern is this code in Javascript? -