ActionBar pre Honeycomb ActionBar pre Honeycomb android android

ActionBar pre Honeycomb


I have written a library for Android which will automatically wrap your pre-3.0 activities with a custom implementation of the action bar design pattern. You can then call getSupportActionBar() which will provide a common interface for both the native and custom implementations, depending on which version of Android your application is running on.

The library also allows you to apply custom styles to both of these action bars through a single theme.

You can find out more information as well as screenshots of sample applications at actionbarsherlock.com.

The library is 100% open source and available at github.com/JakeWharton/ActionBarSherlock.


Android pre-Honeycomb doesn't have an ActionBar, so any method concerning the actionBar will just fail. You should take a look at the code from the Google IO app, which uses an ActionBar both for Honeycomb and pre-Honeycomb.

Put simply, it won't work by itself, you'll have to include your own ActionBar code.


From the API Guide for the Action Bar it says:

the Action Bar Compatibility sample app provides an API layer and action bar layout that allows your app to use some of the ActionBar APIs and also support older versions of Android by replacing the traditional title bar with a custom action bar layout.

You can get this by installing the Android 4.1 (API 16) samples.

Then in Eclipse:

  1. Go to File > New > Project
  2. Android > Android Sample Project
  3. Check Android 4.1
  4. Select ActionBarCompat