Multi-Select Custom ListView with Contextual Actionbar Using ActionBarSherlock for Android API 2.1(Froyo) Later

Recently I was developing an application in Android where I required to show a custom list with multi-select facility along with contextual actionbar. Since there was also a requirement to support the old Android devices I chose ActionBarSherlock library to deal with the actionbar related functionality. The problem that I was facing was that there was no support for MultiChoiceModeListener (added in API 11) in ActionBarSherlock for the old devices.

Then I decided to use two different approaches for different generations of devices. For post Honeycomb devices I used the usual approach of using the available MultiChoiceModeListener and for pre Honeycomb devices I used ActionMode.Callback from ActionBarSherlock library.

I also got help from this site which provided me a custom layout with checkable behavior.

The source code can be found at Github

The actual app looked like the following in Android KitKat (4.4.2):

KITKAT1 KITKAT2
In Android Froyo (2.1) :
FROYO1 FROYO2

Leave a Reply

Your email address will not be published. Required fields are marked *