Logo Icon Logo
A Crowd-sourced Cookbook on Writing Great Android® Apps
GitHub logo Twitter logo OReilly Book Cover Art

Using ActionBar on older Devices

In Chapter: GUI Alerts: Menus, Dialogs, Toasts and Notifications
Author: Ian Darwin ('idarwin')
Published? true
FormatLanguage: WikiFormat


The ActionBar component, introduced in Honeycomb and upgraded in ICS, is a combination of a titlebar, menu items that get promoted to buttons, and a Menu Button to replace the hardware button that is absent in almost all 3.0+ devices. This is good functionality, and it would be nice to be able to use it on pre-4.x devices.


There are two solutions:

  1. ActionBarCompat, a demo application (from Google) containing the classes you need;
  2. ActionBarSherlock, a third-party Android Library Project containing the compatibility classes.


ActionBarCompat is included in the Samples folder for each API that it works on. As in 1829 just download the samples for your API level (using the Download Manager), and create an "Android Sample Project" for ActionBarCompat. Run the app and you should see this admittedly simple view, regardless of API level.

ActionBarSherlock has a much larger download footprint, as a single GIT repository holds everything (including the projects complete web site, dozens of themes, dozens of test cases, etc.). You can download it from [1].

Note that neither is completely transparent - you both require the Support Library, and both require you to use a different parent class for your activity. A small price to pay for what you get!