Multichoicemode Before Api 11
Solution 1:
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 a onItemClickListener
that would check what items are checked on the ListView and to create a private class implementing ActionMode.Callback
that will manage the contextual ActionBar.
I let you go on that blogpost to see everything detailed, and some piece of codes !
Solution 2:
You can also have a look at the Google I/O 2012 App. It's opensource, and uses ActionBarSherlock. They have developed a compatibility version of ActionMode related classes that work fine with ABS and on pre-honeycomb devices.
In particular, Take a look at:
- SessionsFragment class : It shows usage of the compatibility version of ActionMode
- util.actionmodecompat package: It contains the compatibility ActionMode classes
Basically, just like ABS, their use native implementation of ActionMode when it is available and fallback to the custom implementation on older devices.
Hope it helps!
Post a Comment for "Multichoicemode Before Api 11"