Action bar implementation with ActionbarSherlock - android

I am using ActionBarSherlock to implement action bar on my Android 2.1 API 7 project. (With Eclipse IDE)
In order to use sherlock, after I imported sherlock library as a existing project on Eclipse. I did the following things on my own project:
mouse right click on my project, choose "properties"
in "Android" section, there is "Library" sub-section, I added sherlock project as library
Apply change
Then, I notice the FragmentActivity can not be resolved in my project source code.
I checked the project property again, the added sherlock project as library is not in "Library" section...weired!!! Why it suddenly disappeared even I have added sherlock as library? What am I missing?
I mean no matter how many times I added sherlock as library to my own project, the next time I check project property, the sherlock just disappear from library section...

First, after adding the project as a library, restart Eclipse - I believe this is a known bug with at least some versions of the plugin.
If that doesn't work, check that the 'default.properties' file in your project root is not read only.

Other known problems :
Your app should use the same "Uses-sdk" setting in AndroidManifest like your Sherlock addon
Minimum Java version for Sherlock: 1.6 !
In package with libraries, you also have a lot of samples with source code
ActionBar is not visible in Layouts
Few simple that i remember

Related

Adding sherlock action bar

I want to implement action bar in my android application. I have searched for that and I found out the I need to add some libraries in order to able to use action bar for android 2.X. I started following some online tutorials about adding sherlock actionbar. In every tutorial its mentioned that when I extract the library file which I downloaded from :here
I should get three folders samples, library, and website. But I didn't get them.
So I couldn't follow the rest of the tutorial. Here is the list of the files and folders I have got after extracting the folder :
actionbarsherlock build.gradle deploy_website.sh RELEASING.md
actionbarsherlock-fest CHANGELOG.md LICENSE.txt settings.gradle
actionbarsherlock-i18n checkstyle.xml pom.xml website
actionbarsherlock-samples CONTRIBUTING.md README.md
I'm using Linux mint and eclipse. Can anyone tell me how to add the sherlock library?
Why do you need to use actionbarsherlock ? Support for the action bar is added now in support library.
"From your activity, you can retrieve an instance of ActionBar by calling getSupportActionBar()."
see the link below for more info.
http://developer.android.com/tools/support-library/index.html
http://developer.android.com/reference/android/support/v7/app/ActionBar.html
Why don't you use use ActionBar Compat?
It's available in the support library v7, allows minSdk 7 and it's a library from Google.
Furthermore the development of ActionBarSherlock is stopped
1.First you need to import sherlock lib project to eclipse.
2.Now add this library project to your sample project(Right click on project ->Properties--->Android-->add library)
NOTE: your sample project path and library project path shall be same.
3.Now create a Sherlock Activity instead of simple activity by extending SherlockActivity class .
4.You also need to change theme also.
https://github.com/jfeinstein10/SlidingMenu is a good example for Sherlock download as zip and import it to you workspace i hope it help you

SherlockActivity cannot be resolved to a type when update the latest sherlock library in android?

when I use sherlock library 4.2.0.0 in my android apps my apps working fine and update the sherlock library with 4.4.0.0 then my apps working fine but when upgrade eclipse and android sdk then got error "SherlockActivity cannot be resolved to a type" and other classes and methods of sherlock giving a same error "--- cannot be resolved to a type" .
When i upgrade my eclipse i saw some changes in folder structure and showing error under
"Android Private Libraries" folder like "missing" something.
some people suggest me delete the android-support-v4.jar from libs because this already present in "Android Private Libraries" then i deleted. when the build the all android projects then I got error "error while execute aapt.exe" on popup . I don't know why this
happen.
Que.1 is there any file missing while i am updating eclipse.
I did add library like a,
create new android project -> make it library without creating activity -> after that ->
import the sherlock library into that project.
and add this library to the my android apps
project properties -> add sherlock libary
I am also upgrade eclipse and sdk. I tried lot of way to add the sherlock library but not added yet. please suggest me some solution because i want to deploy my apps.
I had a problem with Sherlock and it was Compiler compliance setting that I had to set to 1.6.
Try with Right click on you project -> Properties -> Java Compiler -> Compiler compliance level and set 1.6

Action Bar for Android 2.3

I followed the steps given in http://developer.android.com/tools/support-library/setup.html#add-library
During the step: Create a library project(Adding libraries with resources), for the v7 appcompat project, I see project titled appcompat instead of android-support-v7-appcompat. Where am I going wrong? Please help.
Answer:I realized for older versions of Android SDK we get appcompat titled project not the v7 one.

Importing ActionBarSherlock - android

I am new to Android, and I am setting up a project which needs ActionBarSherlock. I imported the last one as module inside my project so that the error warning import com.actionbarsherlock.app.ActionBar; which was entirely red, is now getting red only on ActionBar. How can I manage this ? Do I have to put ActionBarSherlock in my project lib folder rather than imported it as a module
So you have ABS library module in hand. Now, I'll tell from starting
Start a new project. Make compile with latest (jelly bean) and Theme as None.
In project explorer, navigate to libs folder and delete supportv4 jar file.
Now, include your ABS library following properties-->Android-->library
finally, change theme as,
< application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.Sherlock" >
a priori, I manage to do the trick, by importing ActionBarSherlock as module. Then, I stll got an error upon ActionBar in com.actionbarsherlock.app.ActionBar. In my code, I edited the help warning popup box showing optimizing imports and adding as dependecy module , and clicked on the latest, and it worked fine
Go to file-->import-->Android-existing code into workplace, Then select ActionBarSherlock's Library, After importing go to the properties of the project in which you wanna add actionBar.
Do this by right clicking on your project in package explorer -->properties--> under Android click add in the library section and choose the actionBarsherlock lilbrary listed there.
EDIT:
I would suggest you look here. Make sure that you have checked is library option. But what I think initially is that the library is added perfectly since its now recognising com.actionbarsherlock.app package. One common bug is that actionbarsherlock and your project both contains the android support package library, try deleting the android support library from your project since your project should be using the support library from actionbarsherlock. Remember to backup your code.
EDIT 2: You should be extending sherlockActivity instead of normal activity, same stands for Fragments, A fragment would be changed to sherlockFragment. These are the widgets that will come from sherlock library.
Refer this link also

Error importing HoloEverywhere

First of all, I am new with Android.
I am doing an app, and I am implementing a library called HoloEverywhere.
This library use in the themes.xml the library ActionBar Sherlock. I have imported to my workspace ActionBar Sherlock and I have added it to HoloEverywhere.
Next, I have added HoloEverywhere to my project, but when I try to use it, I have an error (I tried to use a button):
The following classes could not be instantiated:
- com.WazaBe.HoloEverywhere.ButtonHolo (Open Class, Show Error Log)
See the Error Log (Window > Show View) for more details.
Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse.
I put the path of the class in my layout, like this:
<com.WazaBe.HoloEverywhere.ButtonHolo
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/text" />
How I can solve this problem and use this library in my project?. Thanks :)
PS. Sorry for my english, I know it is not very good.
Follow the steps below(taken from blog here) to add ActionBarSherlock
Download the .zip/.tgz and extract it
Go to eclipse and choose File->New-> Android Project
Select Create project from existing source and then browse to the library folder inside extracted AndroidBarSherlock folder
Build Target should be the latest(14 or15), but your minSdkVersion can be less (7 or 8)
Press Finish
Right click on the newly created project and go to Properties.
Under the Android heading, you should see a section for Library with a checkbox IsLibrary. Make sure that's checked.
Right click -> Properies on the project in which you wish to add AndroidBarSherlock under the Android heading and the Library section choose Add.
You should see the ActionBarSherlock library, add this to your project
Lastly, if you were using the compatibility support , you need to delete that jar since it's included in ActionBarSherlock.
Follow the steps below to add HoloEverywhere
Download Zip from GitHub to your computer
UnZip the folder
Go to eclipse and choose File->New-> Android Project
Select Create project from existing source and then browse to the HoloEverywhereLib folder inside extracted folder
Press Finish
Right click on the newly created project and go to Properties.
Under the Android heading, you should see a section for Library with a checkbox IsLibrary. Make sure that's checked and press Add and previously added library ActionBarSherlock.
Follow these steps to add HoloEverywhere to your project
Create a new Android project
Right Click on project -> Properties -> Android -> Add, add both ActionBarSherlock and HoloEverywhere
Change the Android Manifest to following
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Holo.Theme">
Edit you main.xml to include Holo theme widgets.
Change your activity as follows
public class ChkActionBarSherlock extends SherlockActivity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
It seems that
android:theme="#style/Theme.HoloEverywhereDark.Sherlock"
cause an error.
change it:
android:theme="#style/Holo.Theme"
resons here:
Github
correct!
I had the same error on my project, This is what I did, right click the HoloEverywhere (properties->android->library) remove the ActionBarSherlock from the list then re-add the ActionBarSherlock project by click add, after that clean up the project and all errors will disappear.
The creator of ActionBarSherlock, Jake Wharton, announced on Google+ that further development of ActionBarSherlock has been stopped. ActionBarSherlock 4.4 is the last release and might get bug fixes – but there won’t be any new features:
While there may be a dot release or two in the coming weeks, version
4.4 is shaping up to be The Last Release™.
https://plus.google.com/+JakeWharton/posts/F3HkWY9J8fK
As i asked on holoeverywhere issues forum and answered by devs:
HoloEverywhere doesn't have any dependency with ABS since v2.0
So you should not use ABS anymore and remove the library from your project and replace it holoeverywhere directly or with ActionbarCompat from google support library.

Categories

Resources