I have a custom ExpandableListView elv and I am able to detect when a Child is clicked with the code below.
elv.setOnChildClickListener(new OnChildClickListener() {
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
int childPosition, long id) {
However, when I change it to try to detect when a group item is clicked, this does not work. Does anyone know why?
Eclipse gives me the error:
The method setOnGroupClickListener(ExpandableListView.OnGroupClickListener) in the type ExpandableListView is not applicable for the arguments (new OnGroupClickListener(){})
elv.setOnGroupClickListener(new OnGroupClickListener() {
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition,
long id) {
Make sure you have imported android.widget.ExpandableListView.OnGroupClickListener
right or replace
new OnGroupClickListener() {
with new android.widget.ExpandableListView.OnGroupClickListener {