ExpandableListView has a setOnChildClickListener method, but lacks of setOnChildLongClickListener method.
When I added setOnL
I know this answer may be no need, but I have similar situation and non of these answer solve my problem. So I post mine in case someone may need it. Hope all you guys don't mind.
@Override
public boolean onItemLongClick(AdapterView> parent, View childView, int flatPos, long id) {
if (ExpandableListView.getPackedPositionType(id) == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
final ExpandableListAdapter adapter = ((ExpandableListView) parent).getExpandableListAdapter();
long packedPos = ((ExpandableListView) parent).getExpandableListPosition(flatPos);
int groupPosition = ExpandableListView.getPackedPositionGroup(packedPos);
int childPosition = ExpandableListView.getPackedPositionChild(packedPos);
// do whatever you want with groupPos and childPos here - I used these to get my object from list adapter.
return false;
}
Edit This solution for Listview was long time ago. I highly recommend to move to RecyclerView now.