Friday, May 3, 2013

[android help] Adding ActionBarSherlock in Eclipse Juno


From this web http://www.grokkingandroid.com/adding-actionbarsherlock-to-your-project/


Getting ActionBarSherlock and adding it to Eclipse


The first thing you have to do, is to download the library from actionbarsherlock.com. After this unzip/untar it. The download contains three folders: library, samples and website. The samples folder contains four sample projects to showcase what you can do and to show you how to do it. You should have a look at them. The website folder contains the code of the project website. The library folder finally contains ActionBarSherlock’s source code. Now go to Eclipse and add the ABS-library as an Android project. Do not use Eclipse’s import tool to import the ActionBarSherlock library – it would not work immediately and you would have to fix some settings. Instead use the project creation wizard of the Android Developer Tools.


Open File -> New -> Project -> Android Project From Existing Code.


Creating an Android project from existing source In the next screen select the folder, which Eclipse then uses to search for projects. If you select the ActionBarSherlock root folder, Eclipse suggests a list of projects to create. Leave the “library” project checked and uncheck all others:


Select the library project Click “Finish” to create the project.


Eclipse will now create a new project named “library”. I prefer a more useful name, so select the project called “library” and hit F2 to rename the project. I have renamed the project in Eclipse to “ActionBarSherlock”, so all following screens will refer to this name.


Adding the library to your project


Now that ABS is a library project you have to tell your own project to use it. I will use the project of my last post for this. Go to FragmentStarter’s project settings and switch to the Android tab.


If necessary scroll down until you see the Library panel. Click “Add”:


Adding libraries to an Android project In the next window all available library projects will be listed. Select ActionBarSherlock and click “Ok”.


Select ActionBarSherlock from the list of libraries When the window disappears the library should be listed in the library panel of the Android properties tab:


Check if the library has been added succesfully


Then appears an error: Jar mismatch! fix your dependencies, to solve it there is to copy the file android-support-v4.jar from your_project/libs and paste it on library/libs.


Before you can use ActionBarSherlock you have to extends your Activity like this: public class MainActivity extends SherlockActivity and change the theme in Manifest: android:theme="@style/Theme.Sherlock.Light.DarkActionBar"


This is the way to add ABS to your project. Hope it works for all



.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...