I've got a silly little problem. I've registered a ListFragment both as OnItemClickListener and OnItemLongClickListener of its own ListView.
When the onItemClick event is called, an intent for the detail view activity of that item is started, no problems there.
When the onItemLongClickevent happens, I want to accomplish the following things:
- Create a CAB
- Keep the long-pressed item selected
Code:
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
if(this.cabMode != null)
return false;
this.cabMode = getActivity().startActionMode(editModeCallback);
view.setSelected(true);
return true;
}
The CAB will show, however, the selection won't stay with the item.
Some bits and pieces, in case they are relevant: I've read about fixing this issue with calls to view.requestFocusFromTouch() or using listView.setItemChecked(), but that didn't work for me. Also, the views for the list items are instanced from a custom layout, but don't have any custom event listeners attached.
Any help is appreciated. Thx!