onCreateContextMenu isn't being called

spuppett picture spuppett · Jan 29, 2012 · Viewed 7.2k times · Source

It looks like the onCreateContextMenu insn't being called at all. In my onCreate for my ListActivity I have:

list = getListView();
registerForContextMenu(list);

(I know it's redundant, and I've just passed getListView() with the same results).

Here is my onCreateOntextMenu;

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    Log.d("LM", "onCreateContextMenu");

    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.context_landmarks, menu);
}

The log never gets generated. Doesn't anyone have any suggestions?

Answer

lulumeya picture lulumeya · Jan 29, 2012

My thought is ListView intercepting the event and not going into contextMenu behaviour. It make sense to me because the OnItemLongClickListener behaviour overlaps contextMenu's. If not how it can recognize between contextMenu and OnItemLongClickListener?