I'm very new to greendroid and I had a quick look on its functionalities. If I want to develop with the android 4 sdk does it still make sense to use greendroid? Is that gonna work?
For example let's take the ActionBar. There's one in greendroid but android 4 has now that functionality too so what? Of course it's only one element but is there still an advantage to use greendroid when the base sdk is android 4?
isn't this library intended to support older versions (like 2.x and below) ?
if so (and my guess is that it is ) : if you don't wish to allow such devices to be able to run your app , then you don't need this library .
otherwise , if you wish to have the action bar functionality , you should consider using it (or any other solution for the action bar , like the action bar sherlock or the android library that google gives.) .
most devices today do not have a new version of android . currently , most of them run version 2.x .
here's the current statistics:
http://developer.android.com/resources/dashboard/platform-versions.html
Related
I'm newbie in development for Android platform and trying to understand how do I know or predict when I have to use support classes? This is probably stupid question, but let me give you a simple example. Let's say I want to add a sharing functionality to my application so I go to DAC and see there an example of how this can be done. I read the manual carefully and see the note about limitations i.e.
Note: ShareActionProvider is available starting with API Level 14 and higher
It seems this is OK for me since the minSdkVersion is set to 14 in my app. I copy-paste that snippet to my project, launch the application and... it crashes with the following error:
05-21 12:42:07.638: E/AndroidRuntime(25291): java.lang.UnsupportedOperationException: This is not supported, use MenuItemCompat.getActionProvider()
I update my sources to use the following code instead the one which I found in documentation:
MenuItem menuItem = menu.findItem(R.id.action_share);
ShareActionProvider mShareActionProvider = (ShareActionProvider)MenuItemCompat.getActionProvider(menuItem);
Starting app. At first sight it's working but instead of share icon I can see text SHARE in the ActionBar. Humm, after googling around I replace the following line in menu layout
android:actionProviderClass="android.widget.ShareActionProvider"
to
app:actionProviderClass="android.support.v7.widget.ShareActionProvider"
Hooray! Finally I've got what I want!
This is not the first time I experience such obstacles while learning the Android platform so I'm trying to find whether there is any rule of thumb which will help me to predict such situations?
As for support library, not that I've added it for purpose. This library was added automatically when I created project in Android Studio. After playing a little bit with Android Studio I've figured out that it automatically adds it to the project unless the min SDK is set to latest 21 or 22 versions. So technically almost all applications have to use this library to be run on wider range of Android devices. If this is true then why Android training and guide materials don't use support classes in examples?
Any help and advice will be highly appreciated.
I'm trying to find whether there is any rule of thumb which will help me to predict such situations
I have no idea what "such situations" are beyond the one that you have cited here.
In this specific case, the menu resource cited in the first step uses android:showAsAction="ifRoom" instead of something like app:showAsAction="ifRoom". The latter is required if you are using the appcompat-v7 action bar backport. Hence, this sample must not be using the appcompat-v7 action bar backport.
There is little question that the documentation could be improved in this area, to either provide instructions for both action bar implementations, or to at least positively state which action bar implementation that they are using.
So technically almost all applications have to use this library to be ran on wider range of Android devices.
No. Zero applications have to use appcompat-v7 to be run on a wide range of Android devices, going all the way back to API Level 1.
However:
If you want an action bar on devices running Android 1.x/2.x, you need an action bar backport, and appcompat-v7 is the only currently maintained full-featured backport that I am aware of (given that ActionBarSherlock is deprecated)
If you want to try to have a UI that resembles Material Design on devices running Android 4.4 and below, current editions of appcompat-v7 do that as well
I'm planning an Android app that should make use of lots of UI features that later SDK versions bring with them incl. ActionBar, ActionBar.Tabs, Swipe navigation and use of Fragments (with replace, add, FragmentTransaction etc). The app should support SDK 8 (2.2) and later.
I'm a 'bit' at a loss here on how to set this up: will I be able to use all these features with the official Android compatibility library? Or will I have to use ActionBarSherlock? Will ABS give me advantages/ be easier to implement compared to the official comp. library?
Can I use the Eclipse/ ADT navigation templates with those two librarys? Can I use them alongside each other or do I have to comit to one of them?
Lot's of questions, I know :)
will I be able to use all these features with the official Android compatibility library?
No.
Or will I have to use ActionBarSherlock?
Yes.
Will ABS give me advantages/ be easier to implement compared to the official comp. library?
It will give you a backwards-compatible action bar. The Android Support Library does not.
Can I use the Eclipse/ ADT navigation templates with those two librarys?
You can do whatever you want. You will need to replace some stuff generated by those templates.
I think using using ActionBarSherlock is the best.
Have a look at this link
I am creating application which will support Android 2.2 to Android 4.1. The TabHost is deprecated in Android version 3.2. But the created application supported in all the versions. But I want to create the Tab bar application which will look like a tab bar in Android 4.1 while running the application in Android 4.2, If I am running the application in below android 3.2 version device, it must look like the tab bar in that device. How can I do this.?
There are many points to your question,
TabHost is not deprecated yet. Recently Google deprecated TabActivity and ActivityGroup.
Even if it deprecated, it doesn't mean it can't be used. If X is deprecated, it only means a better alternative named Y is there.
Now to answer your question, You have more than one options
You can use ActionBarSherlock as other answers suggests. (EDIT : ActionBarSherlock is now deprecated.)
You can use TabHost with fragments, See my answer here for a
good example. To use Fragment in pre 3.0 API's you need to use
Google's support library.
Try out ActionBarSherlock.
ActionBarSherlock is an extension of the support library designed to facilitate the use of the action bar design pattern across all versions of Android with a single API.
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.
Tutorials:
tutorial 1 , tutorial 2 ,
tutorial 3
Just to add, Android has introduced ActionBarCompat to ensure ActionBar is compatible with OS below 3.0 down to 2.1. You can use ActionBarCompat in the support library instead of ActionBarSherlock
http://android-developers.blogspot.co.uk/2013/08/actionbarcompat-and-io-2013-app-source.html
Is there a easy way to have our application look like ICS or JB?
Mainly the slider and the radio button. They look old when displayed in green.
Any hint about this?
There's a nice package available on github called HoloEverywhere.
One thing though, do not try pass it off as a ICS/JB Application, just because it "looks" like the user interface one would expect to see in a native ICS/JB Android set up.
Best that can be done with the project, is to target the latest SDK to guarantee your wide-market of Android usage, including GB.
Aim high, not low ;)
The best way is to use the Android Library 'Actionbar Sherlock'. This Library uses all native ICS Themes, etc for older devices.
ActionBarSherlock is an extension of the compatibility library designed to facilitate the use of the action bar design pattern across all versions of Android with a single API.
I want to develop a new Android app. Design guidelines for Droid 3.0+ encourage the use of fragments to create a UI that better utilizes tablets' screen space. Also, from Droid 3.0+ I have read that a menu bar should exist on every activity that has a menu instead of using the plain old menu key
These features are supported by SDK 11+, but I want to support SDK 8 as minimum SDK in order to achieve best market share (see here).
How can I achieve both of my objectives?
You have two possibilities:
Google provide support library for developing apps with using fragments and action bars with support of old android versions.
There is great tool Action Bar Sherlock.