Improving Floaf Response: declare
public static int firstVisiblePosition=0;
when paused
int numberOfGroups = MyExpandableListViewAdapter.getGroupCount(); boolean[] groupExpandedArray = new boolean[numberOfGroups]; for (int i=0;i<numberOfGroups;i++){ groupExpandedArray[i] = MyExpandableListView.isGroupExpanded(i); } firstVisiblePosition = MyExpandableListView.getFirstVisiblePosition();
onResume
for (int i=0;i<groupExpandedArray.length;i++){ if (groupExpandedArray[i] == true) MyExpandableListView.expandGroup(i); } MyExpandableListView.setSelection(firstVisiblePosition );
This will not only restore each state of the group, but also result in viewing the child that was viewed when the activity was paused.
Anonymous
source share