Aksiom
Aksiom

Reputation: 1585

Expand a specific GroupView programmatically

I have an ExpandableListView and everything is working fine. Now I want to be able to expand a specific GroupView.

The idea: After a search query I got a result as a String. That String is then used to locate the GroupView, more accurate a String value in that GroupView. When the strings match I want to expand that GroupView and scroll to that position of the screen.

Is it possible to do this?

Upvotes: 0

Views: 429

Answers (1)

Srinivasan
Srinivasan

Reputation: 4661

if(!yourExpandableListView.isGroupExpanded(groupPosition)){
yourExpandableListView.expandGroup(groupPosition);
}

The above code used to expand the particular groupview programmatically.For that you have to get groupPosition. Upto my knowledge you cant able to match the group item string value, instead you can query and get string with id(groupPosition) using that groupPostion you can expand the particular GroupView.

Upvotes: 1

Related Questions