I'm attempting to get contextual action bar working in a fragment to get multiple deletes. I'm placing this within the check API 11 and after. I'm using Sherlock Fragment for backward compatibility. I have set the choice mode and listener for multiple selections.
The Problem is when onCreateActionMode
is called it`s failing to inflate the menu; I already have an inflated menu in this fragment. The CAB code is more or less the same as in example Multiple selection in custom ListView with CAB and it is working perfectly well when I try it on its own separately. I am not sure what is going wrong here -is it a conflict with sherlockfragment or is it because of the existing menu or is there some minor correction that I'm missing.
I also have the problem that now that I have set a long click listener my onclick listener is never triggered but I think I have found a post addressing that problem.
I'm pasting snippets below
@Override
public View onCreateView...
{
View v =inflater.inflate(R.layout.top_event_empty_list, parent,false);
ListView listView = (ListView)v.findViewById(android.R.id.list);
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
listView.setMultiChoiceModeListener(new MultiChoiceModeListener(){
........
@Override
public boolean onCreateActionMode(android.view.ActionMode mode,
android.view.Menu menu) {
android.view.MenuInflater inflater=mode.getMenuInflater();
inflater.inflate(R.menu.fragment_event_context_menu,menu);
......