Android App Which Targets API21, needs AppCompat? - android

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.

Related

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.

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.

Android Action compatibility from 2.2 to 4.2

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.

Which are the minimum API requirements of the compatibility package?

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".

Categories

Resources