Search code examples
androidandroid-layoutandroid-actionbarcontextual-action-bar

Android Contextual Action Bar API 8+


I want to use Contextual Action Bar in my app which supports API 8+ for multiple selection in the ListView.
I have read that Contextual Action Bar is supported on API 11+ and for older devices I should provide older Floating Context Menu.

Anyway I'm wondering if there isn't a newer solution, for example some supportlibrary v7 update supporting CAB or so.

I'm not using ActionBarSherlock and I don't want to...


Solution

  • The ActionBarActivity from the v7 support library supports the Contextual Action Bar via the same APIs as the API 11+ Activity class. The only difference is that the support methods all have "support" in them and you need to use the android.support.v7.view.ActionMode.Callback class for callbacks instead of the non-support version.

    This has been a part of the v7 support library since the ActionBar classes were added to support the Action Bar in reversion 18, released in July of 2013.

    See: