views:

30

answers:

1

I have a ListView with a ContextMenu, it has one CheckBox (the CheckBox has android:focusable="false") and one TextView per row, but you can hide the TextView in the preferences menu.

After doing that, the CheckBox wasn't registering the ContextMenu, so of course, why not registerForContextMenu(cb) and unregisterForContextMenu(getListView())? Yes, i did that, but then, when when i call the delete command of onContextItemSelected, the app crashs.

  AdapterContextMenuInfo info=(AdapterContextMenuInfo)item.getMenuInfo();
  db.deletarTarefa(info.id);

So here i am, accepting ideias and help! :)

+1  A: 

Unfortunately, item.getMenuInfo() will be null when you are using a listView that has a custom adapter.

gregm
alright, thank you gregm!
Philipz