Reputation: 32233
How can I retrieve the group clicked in a OnGroupClickListener of a ExpandableListView.
I have tried parent.getItemAtPosition(groupPosition) and it return groups and childs so I think I must convert the groupPosition to a absolute position in the adapter, but I don't know how to do it.
new OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
Item item= parent.getItemAtPosition(groupPosition);
return true;
}
}
Upvotes: 0
Views: 271
Reputation: 30611
Try this:
new OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
Object object = parent.getExpandableListAdapter().getGroup(groupPosition);
....
....
return true;
}
}
This should work.
Upvotes: 1