A simple guide to get the ActionBar on older versions of Android
After i released SpecCheck a couple of weeks ago, I got quite a few PMs and quoted posts with users asking me how I managed to get the ActionBar working on pre-Honeycomb devices. The solution is simple : a library by Jake Wharton called ActionBarSherlock. So i decided to write a guide for it
► What you'll need?
➤ An internet connection
➤ Sufficient knowledge of Android programming
➤ Common sense
In this guide, I will show you how to add ActionBarSherlock to your app. Its quite simple, and has marvelous results.
➤ Step 1:
Download the ActionBarSherlock zip from here
➤ Step 2:
Extract the zip using 7zip or any similar software
➤ Step 3:
Open the extacted folder and rename the "library" folder to "actionbarsherlock". This is optional, but useful once you import the library into eclipse. It helps distinguish between different libaries.
➤ Step 4:
Open Eclipse and select File-->Import-->Existing Android code into workspace
➤ Step 5:
Set the root directory to the directory that contains the extracted ActionBarSherlock
➤ Step 6:
You will see multiple options appear below. Deselect all except library (or actionbarsherlock depending on whether you renamed it in Step 3)
Make sure that "Copy projects into workspace" is selected
➤ Step 7:
Once done, wait for the workspace to build. Then right click on the project you just imported and select Properties
➤ Step 8:
Under the "Android" heading, you can see all platforms and extras you downloaded while setting up the SDK. Ignore that and scroll down. Tick the "isLibrary" option and select OK
➤ Step 9:
Now right click the project in which you want to implement ActionBarSherlock and select Propeties-->Android. Near the bottom, below the isLibrary option, there is an Add button. Click it and select the actionbarsherlock project.
➤ Step 10:
Delete the "android-support-v4.jar" from the libs folder in the actionbarshelock project and instead, paste the "android-support-v4.jar" from the libs folder in your application project there
➤ Step 11:
Change your application code to their ActionBarShelock counterparts.
Example, Activity becomes ShelockActivity, Fragment becomes SherlockFragment, getActionBar becomes getSupportActionBar and getMenuInflater becomes getSupportMenuInflater. A simple Google Search can help with this
➤ @Chris95X8 : friend and mentor
If you run into any errors or complications, feel free to let me know. I'll be glad to help