hi frnds in my application i use expandableListView. an i need to integrate a contextMenu for the expandable listView. in my expandable ListView i inflate different layouts for different child. so when i do a long click on each childView i need to perform different action.
here i gives the code for ContextMenu.
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
ExpandableListView.ExpandableListContextMenuInfo info=
(ExpandableListView.ExpandableListContextMenuInfo)menuInfo;
int type=ExpandableListView.getPackedPositionType(info.packedPosition);
Log.e("type",""+type);
menu.setHeaderTitle("Options");
menu.add(1, 1, 1, "Edit");
}
@Override
public boolean onContextItemSelected(MenuItem item) {
ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo)item.getMenuInfo();
if(item.getItemId()==1)
{
Log.e("clickd","menu");
}
return super.onContextItemSelected(item);
}
and in my onCreate() i register the listView forContextMenu.
registerForContextMenu(expListView);
but when i press on the GroupView it desplay the contextMenu. but when i click on the childView it doesn't shows the ContextMenu.. pls help me.....