Skip to content

Handling context menu

Eduardo Kozachek edited this page Jan 8, 2014 · 1 revision

If you used ListView with context menu and then changed ListView to StickyListHeadersListView, then keep in mind, that view.getId() will be different so you should change your onCreateContextMenu() code accordingly:

before:

@Override
   public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
      if (view.getId() == R.id.sidemenu_links) {
      }
   }

after:

@Override
   public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
      if (((View)view.getParent()).getId() == R.id.sidemenu_links) {
      }
   }
Clone this wiki locally