My question:
Before I go and use an OnLongClickListener, is there a better way to pass the "what was clicked to create this context menu" information when your list view has a custom adapter?
Here are some details:
Normally, my code can just do something like this:
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
and then go on and be happy.
However, ever since I introduced a custom adapter, item.getMenuInfo() is null.
This is a big problem, because my code no longer knows which item was clicked. (My custom Adapter makes each list row a checkbox and a text view)
I tried this but failed:
Created my own special AdapterContextMenuInfo (called "HasAViewMenuInfo"), but when I pass it in this method, it ends up being null in the menu
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo)
{
super.onCreateContextMenu(menu, v, new HasAViewMenuInfo(v));