Reputation: 731
How can i implement the click events on a expandable list view on monodroid, im trying doing like this code but it seems doenst work...Also, theres is not a IOGroupClickListener method.
listview.SetOnChildClickListener(new ExpandableListView.IOnChildClickListener()
{
public override bool OnChildClick (ExpandableListView parent, View v, int groupPosition, int childPosition, long id)
{
return base.OnChildClick (parent, v, groupPosition, childPosition, id);
}
});
Upvotes: 0
Views: 801
Reputation: 260
Just adding the missinge code, which i felt should be there in selected answer
public class MyListener : Java.Lang.Object, ExpandableListView.IOnChildClickListener
{
public override bool OnChildClick (ExpandableListView parent, View v, int groupPosition, int childPosition, long id)
{
return base.OnChildClick (parent, v, groupPosition, childPosition, id);
}
}
In OnCreateView add this specified listener to the the list view using below code
listview.SetOnChildClickListener(new MyListener());
This adds the above created class as a listener and receive callbacks.
Upvotes: 0
Reputation: 9982
C# doesn't support anonymous subclasses like Java, you will need to create a proper class that implements IOnChildClickListener:
public class MyListener : Java.Lang.Object, ExpandableListView.IOnChildClickListener
{
public override bool OnChildClick (ExpandableListView parent, View v, int groupPosition, int childPosition, long id)
{
return base.OnChildClick (parent, v, groupPosition, childPosition, id);
}
}
Or, depending on what you are trying to do, you may be better off using one of the events, like:
Upvotes: 2