I have a custom adapter, which extends BaseExpandableListAdapter
.
I want my ExpandableList
to expand and collapse when I'm clicking some TextView
.
How should I implement it?
I suppose, i have to add OnClickListener
to methods getGroupView
and getChildView
. And I see, there is boolean flag isExpanded
.
So it should look like this:
@Override
public View getGroupView(int groupPosition, final boolean isExpanded,
View convertView, ViewGroup parent) {
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (isExpanded){
//What should i write here?
}
}
});
return convertView;
}
But what should I write in OnClickListener
? I cannot find any functions, which allow me to expand/collapse my listview.
Is there any function like listView.expandGroup(itemPosition);
?