ExpandableListView collapse All Except - Android android.widget

Android examples for android.widget:ListView

Description

ExpandableListView collapse All Except

Demo Code

import android.widget.ExpandableListView;
public class Main{

    public static void collapseAllExcept(
            ExpandableListView expandableListView, int index) {
        int groupCount = expandableListView.getAdapter().getCount();
        for (int i = 0; i < groupCount; i++) {
            if (index != i) {
                expandableListView.collapseGroup(i);
            }// w w w. j a  v  a  2  s  . c  o  m
        }
    }

}

Related Tutorials