ActionBar from Support Library and phone above Android 3.0 - android

I understand that for Android below 3.0 i need to use ActionBar from v7 support lib
My question is how v7 ActionBar behaves on phones above Android 3.0. Does is use native ActionBar or v7 ActionBar?
I am asking if v7 ActionBar on phones with Android 3.0 and above will be of less quality
(may be less features) than regular ActionBar
Thanks

If you decide to use ActionBarCompat - all your devices will get action bar from compat library. Of course you can have some really tricky API version checks and choose one over another in runtime, but efforts and code complexity just don't worth it. I wouldn't say it is going to be "less quality" since Google guys are really trying hard to make it look the same. Also Im pretty sure list of interfaces is exactly the same as native implementation.
From another hand, there is obviously a risk to hit some nasty bug which is not present (or already fixed) in native implementation, so it is all up to you to take this risk to the benefit of supporting older platforms.

Related

Recommendation between native ActionBar and ActionBarSherlock

I want to use an ActionBar for Android 4.0+ (API 14 and above).
Do you recommend still use ActionBarSherlock, the support library or the native library?
What's the difference between ActionBarSherlock and native ActionBar in Android 4.0+?
Thanks
If you're not supporting older devices, there's no reason to use a compatibility surrogate.
I'd go for the native library.
So, not to add extra weight to my app and take advantage of what I already have.
In the other hand, if and external library would offer so many extra features, I could consider it.
Better if it's open source, so that I can cut off all the features I'm not interested in.

Using support classes in new versions of Android

If I'm trying to make my App work on older devices, I use the Support Libary and ActionBarSherlock.
Of Course, they also work on newer devices. But should i use them on new OS versions, or change the code and resource files so that 4.0 devices for example all use the stock classes and not the support ones.
For example (pseudocode):
if (running 4.0+){
ActionBar= getActionBar();
}else{
ActionBar= getSupportActionBar();
}
or just use this one on all versions:
ActionBar= getSupportActionBar();
What are best pratices, and does that affect stability and perfomance ?
You answered yourself already: "Of Course, they also work on newer devices". If it works then it works. Compatibility lib is just portion of Android framework separated from Honeycomb+ code and offered as .jar for use on older devices. If you target older devices, with pre 3.x Androids and HC+ devices at the same time, then if you still want to use fragments and stuff you got no other choice anyway. And you also need compatibility library for ActionBarSherlock, as it needs it as well.
As far as I know, ActionSherlockBar itself automatically switches everything based on the OS version. So you don't need to bother.
I have used it in my application and it works pretty much the same both on 2.3.7 and 4.0.
This is from its website:
The library will automatically use the native action bar when appropriate or will automatically wrap a custom implementation around your layouts. This allows you to easily develop an application with an action bar for every version of Android from 2.x and up.

Best ActionBar compatibility libraries

I'm writing an Android App and I'm trying to choose which compatibility library to choose to implement the ActionBar functionality.
I'm trying to choose between two libraries:
GreenDroid : https://github.com/cyrilmottier/GreenDroid
Android-Actionbar: https://github.com/johannilsson/android-actionbar
From what I could gather, AA(Android-Actionbar) seems to be simpler, and easier to style. But GreenDroid has additional features which make it the more powerful solution in general(not just for an Actionbar).
I left out ActionBarSherlock because it also supports fragments, is more complicated.
IF there are others that I missed, please share!
Use ActionBarSherlock.
It is based on ICS code, is actively developed, and will use the native actionbar when run on ICS. It also plays nicely with the compatibility library and will let your use ICS features such as the split action bar and share providers. Probably the biggest plus is that it uses exactly the same API as ICS. If you don't need fragmetns, you certainly don't have to use them.
Green Droid offers a custom look and feel, not exactly consistent with Android UI design guide lines. Android-Actiobnar is based on custom layouts and only offers basic features.
Here's a discussion (might be biased, since it's by the ABS author): http://corner.squareup.com/2012/05/actionbarsherlock-as-a-base.html
The Android-Actionbar is better, for sure.
Couldn't think of any other ones but I am sure there are.

Using the compatible libraries in android

What is an ideal approach when developing apps using android 4.0 and making it work in android 2.3, I have already imported compatibility library and Android Sherlock? on my project?
Should I use the coding practices of 4.0 until my app is in shape before I apply compatibility practices?
OR
I should apply the compatibility practices together with the project's progression (which is kinda hardcore.. for a beginner of the compatibility library like me )?
I would appreciate your opinions.
I may be a bit biased, but by using the Google support library, ActionBarSherlock, and NineOldAndroids you are afforded all of the major new features introduced in Honeycomb to 99% of all devices that have access to the Play Store.
Having easy access to fragments, loaders, the action bar, and the new animation API on Android 2.1+ allows for you to focus on the actual content of your application rather than any API differences.
Action Bar Sherlock is meant to replicate the Android 4.0 experience as closely as possible on legacy systems, so I suggest you use it in that spirit. Try to develop clean Ice Cream Sandwich code, just keep an eye on whether ABS supports it. Most of the time, it will. If it doesn't, find another way. Every time you finish coding up an Activity would probably be a good time to step back and do a quick Gingerbread sanity check.

Implementing recently introduced Android design and UI guidelines on 2.x versions

Considering Android Design Guidelines announcement what is the best way to make apps which are compliant with them on Android 2.x phones? E.g. what is the best way to implement the ActionBar pattern?
ActionbarSherlock is a starting point. It includes the compatibility libraries from Google and comes provided as a project rather than JAR offering greater flexibility, should you need to alter anything. Version 4 is on the way which will also include ICS stuff.
As far as I am aware I believe ABS is backward compatible to 1.6, and makes use of the minSdkVersion and targetSdkVersion. It uses an extended version of the holo theme to create a light and dark version that includes the extra ActionBar goodness, which in turn you can extend to style your app.
I recorded a tutorial on YouTube to get people started.
I think it's better to use the compatibilty libraries directly, instead of another library based on those. Additionally, refer to the Google I/O App as stated at the bottom of the first link I gave. You can find the best practices about implementing a UI for several devices with compatibility libraries.
I found ActionBarSherlock to be pretty good. It will emulate ActionBar on older devices and use the native one on modern ones. It's an extension to Android compatibility library - so you will also get fragments and other ICS stuff.

Categories

Resources