Skip to content Skip to sidebar Skip to footer

Multichoicemode Before Api 11

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.setMultiChoiceModeL

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:

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"