I cannot for the life of me figure out why this is happening. I've looked through the ABS sample code (which works fine for non-listviews), I've searched online and followed instructions correctly, but still I have some strange bug.
During my onCreate() I call this code:
lv.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
registerForContextMenu(view);
openContextMenu(view);
return true;
}
});
When long clicking the item, for some reason it keeps going from:
- (line 6)
openContextMenu()
View.showContextMenu()
AbsListView.showContextMenuForChild()
- back to (line 6)
openContextMenu()
I do have a click listener set, but it shouldn't be affecting anything as it opens a new activity if clicked.
For completeness, here's the context menu creation.
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
if (v.getId() == R.id.lvFines) {
menu.add("One");
menu.add("Two");
menu.add("Three");
menu.add("Four");
}
}
Am I using the wrong "support" function from ActionBarSherlock?