I want to know whether the Fragment Manager works in Android API 8 ? I am using the project to compile with Android API 8.
if yes tell me how to use the fragment in lower devices or suggest any tutorial links.
The Android Support Library backports many newer features to older Android versions. In the case of Fragments, they are supported via the support library back through Android 1.6 (API 4) as explained in the features overview. The setup instructions go through everything you need to include the Support Library in your application.
Related
I just started programming using Android Studio and it's so cute. But at first compile some errors occurred.
I added a Login Activity and found out that this activity does not support programming for older phones with API9.
Is there an Android Studio activities for lower version APIs such as API9 (Android 2.3.3) ?
The way to support earlier API versions is through the official Android Support libraries. Mostly these are backported versions of more recent features added in later API levels.
See http://developer.android.com/tools/support-library/index.html for more details.
If you create a new project using the Android Studio wizard and set the minimum SDK level to 9 for example, it will automatically include support library dependencies for you.
If I want to develop an app for API 7 through to 18. I understand I should set minSdkVersion to 7 in the manifest, and I assume I should set 18 as targetSdkVersion. But I'm confused by what SDK I should use for development. Should I be using the SDK for 2.1 (API 7) or 4.3 (API 18)? I don't want compatibility behaviours as I want to completely control and specify what to do on each platform version. And what about the support library? Would I use support libraries 8-18 or 1-7?
(Posted here because development questions are off-topic for android.stackexchange.com)
You can and should use the newest SDK. Eclipse or Intellij will automatically take care of letting you know if you are attempting to use a component that is only available in newer APIs. You will only want to use support library v7 and below since you intend on supporting API 7 and above. A lot of your worries will automatically be taken care of by your IDE. It will let you know if you are trying to use things that are not available in your minimum API level (which you indicate in your manifest file).
I am trying to create an Application on Android and want to target apps all the way down to Android 2.2.
I am a bit confused on how to configure the application
Min SDK: 2.2
Target SDK: 4.1
Compile SDK against: 4.2
This is the default config i got when i created a new Android Project.
Should i still need to use ActionBar Sherlock to support the older versions ?
Unless you are using any API's not available for lower versions, you will not require any additional libraries like ActionBarSherlock.
However, if you are using any specific API's and want to make them backward compatible, for example Fragments, ActionBar, etc then you can make use of the Support Library which supports a minimum API level of 4.
Quote from the Support Library Page:
Minimum API level supported: 4
The Support Package includes static "support libraries" that you can
add to your Android application in order to use APIs that are either
not available for older platform versions or that offer "utility" APIs
that aren't a part of the framework APIs. The goal is to simplify your
development by offering more APIs that you can bundle with your
application so you can worry less about platform versions.
ABS is an extension of the Support Library. This is from the ABS page Link: ActionBarSherlock:
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.
To summarize, if you are making use of API's not available in older SDK's, then you can use either of the two listed above. If you are not using API's specific to newer SDK's, you will not need ABS or the Support Library.
Min SDK = Least API you want to support ie., 2.2
Target SDK = API you want to test on. If not set will take default value as Min SDK. Usually target will be the Max API you want to support or the Latest API. This is to tell the Application to use the latest API Features, but if not possible allow backwards compatibility.
I never heard about Compile SDK
and you don't need any Support libraries if you are using only 2.2 API elements.
For something like Fragments etc.., which are not present in <3.0 API you must use Support Libraries.
I'm writing an app and I want to use the new ActionBar that is available in Android 3.x and later for Android. The app still needs to support the majority of devices out there and most are running 2.x releases.
I've configured my project so that the minSdk is set to API 8 and targetSDK is API 14.
My question is what is best practice for using new SDK features like the ActionBar and still support older devices running older builds of Android that don't support such features?
I would suggest using ActionBarSherlock. It provides backwards compatability for the ICS ActionBar, among other things.
Use v7-appcompat support library.
Check here: http://developer.android.com/tools/support-library/features.html
For setup: https://developer.android.com/tools/support-library/setup.html
My App is coded with 2.2 "SdVersion 8" and when I run it in Ice Cream Sandwich I get the "Contex menu" down in botton right.
I want to take use of the new ICS interface. If I change the App to API-level 14 (Android 4.0) I get the new interface! (On 4.0 phone). BUT the App doesn't seem to start at all on phones with older Android-versions for example 2.2.
If I change minSdkVersion in the "API target 14" to 8 .. I get the old 2.2 interface on 4.0 devices.
So. Is it possible for an App to get the 2.2 interface on a 2.2 device, and 4.0 interface on a 4.0 device?
It is not possible to get the 4.0 interface on a 2.2 device without manually importing all of the resources you need from the Android source into your application and applying them correctly. The reason for this is all Android resources that are used to create the ICS theme are already on the phone. When you reference anything inside of the Android package you are actually referencing the Android version that is installed on a given device.
This is why for example when you open a dialog on an HTC device it looks different than it will on a Samsung device. Device manufactures usually customize some of these built in Android resources to give there device a special look than all other Androids.
So if you wanted to get the look of the ICS interface on all devices you could go into the android sdk you have downloaded and look in "pathToSDK/platforms/android-14/data/res". I would not suggest this as you might not get all of the required dependencies or you might have some conflicting styles that make it hard to see things. Also most users are comfortable with the theme they are used to seeing on their device and if there is an app that makes a major change to that it might take the user off guard.
Edit:
Sorry for my long winded answer as I think I misunderstood your question. You can get a 4.0 interface on a 4.0 and 2.2 interface on a 2.2 by setting the target sdk to 4.0 but leaving the min sdk on the lower setting. This is a deprecated doc but will explain how to do what you are looking for.
You can now also try the support library (appcompat v7 (library project), mediarouter v7 (library project), gridlayout v7 (library project), renderscript v8 (library jar), fragment backwards support v4 (library jar) v13 (library jar) ) from Google released with API Level 18. It can work all the way to 2.1 Eclair in some cases.
There is tutorials on how to import the library with Eclipse.
I have managed to do it with Netbeans Android plugin by adding it via the project properties in libraries section and then browse to the appcompat or other v7 project shown as android library project. The library jars are do