I would like to expand all children while the expandable list view is populated. Currently my code looks like this:
ExpandableListView listView = (ExpandableListView) findViewById(R.id.view);
int count = viewAdapted.getGroupCount();
for (int position = 1; position <= count; position++)
listView.expandGroup(position - 1);
which is pretty ugly. Is there a nicer way to do this?
You can expand it in getGroupView in your custom adapter:
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
View v = super.getGroupView(groupPosition, isExpanded, convertView, parent);
ExpandableListView mExpandableListView = (ExpandableListView) parent;
mExpandableListView.expandGroup(groupPosition);
return v;
}
Gluck!