Skip to content Skip to sidebar Skip to footer

Why Is Menuitem.adaptercontextmenuinfo Null When My List View Has A Custom Adapter?

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 cust

Solution 1:

I suspect that your problem is:

My custom Adapter makes each list row a checkbox and a text view

Temporarily get rid of the checkbox. If your context menu now works, then the checkbox is the issue. Consider switching to a CheckedTextView instead -- that's much better supported with ListView anyway (e.g., use CHOICE_MODE_MULTIPLE, setItemChecked()).

I have used context menus with custom adapters and have not had any issues. But, I have not used checkboxes in my rows.

Post a Comment for "Why Is Menuitem.adaptercontextmenuinfo Null When My List View Has A Custom Adapter?"