How to work in ActionBar support Library.

Today’s post is all about working with ActionBar support libraries from Google.
These libraries support from Android 2.1 (API 7).

For working with these libraries we have to follow some instructins.

Please follow these steps exactly for setting up a Actionbar support library.

1. Start the Android SDK Manager.
In the SDK Manager window, scroll to the end of the Packages list, find the Extras folder and, if necessary, expand to show its contents.
2. Select the Android Support Library item.
Note: If you’re developing with Android Studio, select and install the Android Support Repository item instead.
3. Click the Install packages… button.

After downloading, the tool installs the Support Library files to your existing Android SDK directory. The library files are located in the following subdirectory of your SDK: /extras/android/support/ directory.

Now Open Eclipse and do the following.

Create a library project based on the support library code:

Make sure you have downloaded the Android Support Library using the SDK Manager.
Create a library project and ensure the required JAR files are included in the project’s build path:
Select File > Import.
Select Existing Android Code Into Workspace and click Next.

Browse to the SDK installation directory and then to the Support Library folder. For example, if you are adding the appcompat project, browse to /extras/android/support/v7/appcompat/.

Click Finish to import the project. For the v7 appcompat project, you should now see a new project titled android-support-v7-appcompat.

In the new library project, expand the libs/ folder, right-click each .jar file and select Build Path > Add to Build Path. For example, when creating the the v7 appcompat project, add both the android-support-v4.jar and android-support-v7-appcompat.jar files to the build path.

Right-click the project and select Build Path > Configure Build Path.
In the Order and Export tab, check the .jar files you just added to the build path, so they are available to projects that depend on this library project. For example, the appcompat project requires you to export both the android-support-v4.jar and android-support-v7-appcompat.jar files.
Uncheck Android Dependencies.

Click OK to complete the changes.

AndroidManifest.xml changes

Important
1. To work with support libraries of actionbar you should also have to change the theme to “Theme.AppCompat”.
2. Also your activity should extend ActionBarActivity.

This is all that needed.
After that you can add this actionbar compat library for any number of projects.

Usage.

Instead of using getActionBar(), use should use getSupportActionBar() to point to suppport actionbar libraries.

You can download a sample of Project which contains the ActionBarCompat Library and a sample project which links this library from here.
So when you import it to your eclipse make sure you import two projects included.