Reputation: 695
Just wondering if anyone can help with this - I'm learning and unable to figure it out......
If I register a GridView object with a Context Menu as follows:
registerForContextMenu(gridview);
How can I determine which View object/square in the Grid the menu was initiated from?
Any help would be very much appreciated
Upvotes: 2
Views: 115
Reputation: 3353
In onContextItemSelected()
method, you can get the index of the item on the Grid by using:
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
int index = info.position;
Then use this index for everything you want :)
Upvotes: 1