Which are the minimum API requirements of the compatibility package? - android

I know the Compatibility Package is very useful and provides backward compatibility. One thing i am not sure, will all the libraries in the package can be used on all version of Android let say above 2.1.

Note: The Support Package includes more than one support library. Each one has a different minimum API level. For example, one library requires API level 4 or higher, while another requires API level 13 or higher (v13 is a superset of v4 and includes additional support classes to work with v13 APIs). The minimum version is indicated by the directory name, such as v4/ and v13/.
http://developer.android.com/tools/extras/support-library.html
To support 2.1, use compatibility library "v4".

Related

Android App Which Targets API21, needs AppCompat?

I am going to build a new app, targeting API21 and higher, do I need AppCompat v7 or I can omit it?
It depends on what features you want to implement and which functionalities you want to develop. Targeting API level and minimum API level are both different thing. Your selection of support libraries depends upon your your minimum API level, that is defined by minSdkVersion.
You can decide and derive below conclusion from official Android Developer Documentation:
v4 Support Library
This library is designed to be used with Android 2.3 (API level 9) and higher. It includes the largest set of APIs compared to the other libraries, including support for application components, user interface features, accessibility, data handling, network connectivity, and programming utilities.
v7 Libraries
There are several libraries designed to be used with Android 2.3 (API level 9) and higher. These libraries provide specific feature sets and can be included in your application independently from each other.
v7 AppCompat library
This library adds support for the Action Bar user interface design pattern.
Note: This library depends on the v4 Support Library. If you are using Ant or Eclipse, make sure you include the v4 Support Library as part of this library's classpath.
v13 Support Library
This library is designed to be used for Android 3.2 (API level 13) and higher. It adds support for the Fragment user interface pattern with the (FragmentCompat) class and additional fragment support classes.

What does v7 mean in <android.support.v7.widget.RecyclerView> is this specific to an android version?

I used the above mentioned widget in my XML. However, I'm just seeing a normal list view and not a recycler view on android 5.1. Wanted to understand if the above mentioned widget is specific to a particular OS version?
From the documentation on Android Support Libraries:
Some of the Support Library packages have package names to indicate
the minimum level of the API they originally supported, using a v#
notation, such as the support-v4 package. Starting with Support
Library version 26.0.0 (released in July 2017), the minimum supported
API level has changed to Android 4.0 (API level 14) for all support
library packages. For this reason, when working with any recent
release of the support library, you should not assume that the the v#
package notation indicates a minimum API support level. This change in
recent releases also means that library packages with the v4 and v7
are essentially equivalent in the minimum level of API they support.
For example, the support-v4 and the support-v7 package both support a
minimum API level of 14, for releases of the Support Library from
26.0.0 and higher.
v7 is just part of the package name, and refers to the version of the support library your project is using. There was an earlier version (v4), which was used with API version 4 or less (Android 1.6). Version 7 support library was a later version of the support library, which worked with newer versions of Android, and introduced new features.
Some information about it here
http://developer.android.com/tools/support-library/features.html
No this denotes the version of Android Libraries.
These libraries provide specific feature sets and can be included in
your application independently from each other.
Read more here
I'm just seeing a normal ListView
Well a Recycler View is a modification to the classical ListView. In the Layout Editor it appears like that only.

How do I know what is the minimum api level for a class?

How will I know if a class I use will be compatible with older versions of android. For example, I would like to use the recyclerview (https://developer.android.com/reference/android/support/v7/widget/RecyclerView.html) and I am developing for android version 4.3. Reading the class it does not say what android version it supports. How can this be found (in general for any class)?
In general, the version of the support library indicates the minimum API level:
Support v4 for API Level >= 4
Support v7 for API Level >= 7
and so on
As stated on the documentation
For the support library, the version supported is included in the package name: v7.
http://developer.android.com/tools/support-library/features.html
For classes in general, you would have to check the documentation, ie. Toolbar: Added in API level 21.
For Support Library packages from 24.2.0 and higher it is not necessarily true that v4 = API Level 4.
As stated in this section(Version Support and Package Names in link article):
Some of the Support Library packages have package names to indicate
the minimum level of the API they support, using a v# notation, such
as the support-v4 package. Starting with Support Library version
24.2.0 (released in August 2016), the minimum supported API level has changed to Android 2.3 (API level 9) for all support library packages.
For this reason, when working with any recent release of the support
library, you should not assume that the the v# package notation
indicates a minimum API support level. This change in recent releases
also means that library packages with the v4 and v7 are essentially
equivalent in the minimum level of API they support. For example, the
support-v4 and the support-v7 package both support a minimum API level
of 9, for releases of the Support Library from 24.2.0 and higher.
https://developer.android.com/topic/libraries/support-library/index.html
you are using a feature from v7 support library.
v7 Support Library is designed to be used with Android 2.1 (API level 7) and higher. see this link for details on other version of the suport library.
http://www.tutorialspoint.com/android/android_support_library.htm
Also see this page for more information:
https://developer.android.com/tools/support-library/index.html

Need Some clarification about "android-support-v4.jar"

I am facing some questions on android-support-v4.jar now a days.
What is android-support-v4.jar
What will happen if we remove android-support-v4.jar from \libs folder
Which class files are there in android-support-v4.jar
What is exact usage of android-support-v4.jar in Android
It is the Support Library for Android that provides backward compatibility for developers to use new API Level features in mobiles that doesn't provide that feature. Hence using Support Library you can broaden the range of targeted mobile devices.
The Android Support Library package is a set of code libraries that
provide backward-compatible versions of Android framework APIs as well
as features that are only available through the library APIs. Each
Support Library is backward-compatible to a specific Android API
level. This design means that your applications can use the libraries'
features and still be compatible with devices running Android 1.6 (API
level 4) and up.
You app or atleast some of the features will not work on Android Devices with Older API levels like Honeycomb or Freyo.
You can see all the classes in android-support-v4.jar here.
Eg: Including Support Library you can use ViewPager in API Level 8 which is Freyo.
You can know everything about android-support-v4.jar here.

Android.app or Android.support.v4.app?

I'm trying to implement cursor loaders into my android app. When I write the code for LoaderManagers, eclipse prompts me to import the correct libraries. However there are two options which appear to be the same; android.app and android.support.v4.app. Whats the difference between these two, and which one should I use?
The Android Support Library package is a set of code libraries that provide backward-compatible versions of Android framework APIs as well as features that are only available through the library APIs. Each Support Library is backward-compatible to a specific Android API level. This design means that your applications can use the libraries' features and still be compatible with devices running Android 1.6 (API level 4) and up.
This both are different library android.app is for the i.e. Fragment which are available from the API level 3.0 and above. So to use the Fragments in below api's you have to use its backword compatible libraries form android.support.v4.app to support below the API level than 3.0. So android has provided the flexibility to provide the support in lower version using android.support.v4.app library.
Each Support Library is backward-compatible to a specific Android API level. So whenever you are implmenting anything which is available in 3.0 but not below then you should use its support library.

Categories

Resources