i implement the ActionMode in my Android App with ActionBarSherlock.
With ABS it is possible to build a ActionMode before API 11 but the easy way with:
listView.setMultiChoiceModeListener( new MultiChoiceModeListener() ...
is not for app before API 11.
Has anybody a good way to build a Action Mode Context Menu before API 11?
I want to make a long click on a List Item and start the ActionMode in which i can click multiple items. On a simple click i show a detail site of the list item.
I use the registerForContext() method but this make a simple and long click.
Has anybody a good tip for me.
EDIT
The solution for my question was following: On a long item click i active the action mode and save this in a variable. In the on item click method i implement a if-else statement with:
if( actionMode == null )
{
// open new activity or update second fragment
showDetails( itemPosition );
}
else
{
// update ui or close CAB if no item selected
showCAB( itemPosition );
}
The method showCAB( position ) update the selectedItem count, highlight item background and so on.
Alright, I just did that today, thanks to that site : http://www.miximum.fr/tutos/849-porting-the-contextual-anction-mode-for-pre-honeycomb-android-apps
Basically, you just need to set your ListView ChoiceMode to
ListView.CHOICE_MODE_MULTIPLE, to set aonItemClickListenerthat would check what items are checked on the ListView and to create a private class implementingActionMode.Callbackthat will manage the contextual ActionBar.I let you go on that blogpost to see everything detailed, and some piece of codes !