1

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

Stepan Sanda
  • 2,322
  • 7
  • 31
  • 55

1 Answers1

3

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:

Bryan Herbst
  • 66,602
  • 10
  • 133
  • 120
  • Thank you. I just read about this and want to update my question. But I don't fully understand how can I set `CHOICE_MODE_MULTIPLE_MODAL` to select multiple items in the list? Is is even possible? – Stepan Sanda Jul 11 '14 at 16:26
  • 1
    Unfortunately I do not believe there is a support equivalent of `CHOICE_MODE_MULTIPLE_MODAL` for the support library. [This answer on SO](http://stackoverflow.com/a/10682119/1253844) has a workaround for this. Though the answer uses ActionBarSherlock, the same logic should be re-usable for the support library. – Bryan Herbst Jul 11 '14 at 16:31
  • Ok, I followed this post http://stackoverflow.com/a/14737520/2633630 and change it to work it with support library.. Thank you for your advice – Stepan Sanda Jul 11 '14 at 22:15