I am seeing:
onSupportNavigateUp
supportShouldUpRecreateTask
onCreateSupportNavigateUpTaskStack
onPrepareSupportNavigateUpTaskStack
So what does it refer to?
Hey this support refer to backward compatibility
Definition from tutorialspoint
Support Library Features
The Android Support Library package contains several libraries that can be included in your application. Each of these libraries supports a specific range of Android platform versions and set of features.
In order to effectively use the libraries, it is important to consider that which API level you want to target as each library supports different API level.
Following is a brief description of android support libraries and API level they support.
tutorialspoint android_support_library
Related
I am building a Android library which contains some add-on features on top of support library, adding support library increases the library size, how can I ask the developer using my library to add the support library explicitly or use the one if the developer has already added it. I don't want to package the support library in my own distribution.
This question already has an answer here:
How do make sure there is no conflict of "v7 appcompat or support" of my library when any application uses my library?
(1 answer)
Closed 6 years ago.
I have a android library with com.android.support:appcompat-v7:23.0.1 dependency in the gradle with compliedSDK of 23
I have following doubts
case 1) Say any applicaion with different version com.android.support:appcompat-v7:23.3.0 uses my library.
which version does the android take? Lower one or Higher one? How do i see it?
How do i make sure there is no conflict of v7 appcompat when any app uses my library?
case 2) Say any applicaion with different version com.android.support:appcompat-v7:25.0.1 or com.android.support:appcompat-v7:24+ and different compiledSDk(24 or 25) uses my library.
I know that The support library should not use a different version than the compileSdkVersion.
How does the android merge the support libraries now? (Since the support library version(appcompat-v7:23.0.1) of my library is different from that of the application's compiledSDK (25) )
How do i make sure there is no conflict of v7 appcompat when any app uses my library?
Anyone Please clear my doubts
which version does the android take? Lower one or Higher one? How do i see it?
When building library you put the dependency explicitly in build.gradle. The same is done by the creator of app, that uses your library as a dependency declared in his build.gradle. If the creator explicitly declares support library as a dependency, that version is taken (regardless the versions declared by dependencies). If he does not do that, the highest version declared by any dependency is taken (such support library is regarded as a transitive dependency).
Example: Your library uses appcompat-v7:23.3.0. The creator of app declared appcompat-v7:25.0.1. Simple case: appcompat-v7:25.0.1 is taken.
Example 2: Your library uses appcompat-v7:23.3.0. The creator of app does not use appcompat-v7. appcompat-v7:23.3.0 will be in output app.
Example 3: Your library uses appcompat-v7:23.3.0. Another library uses appcompat-v7:24.1.0. If the creator does not explicitly declare appcompat-v7:xx.x.x the version appcompat-v7:24.1.0 will be in output app.
Hope you understand.
How do i make sure there is no conflict of v7 appcompat when any app uses my library?
You can't assure that. That is why you should always put the highest version of support libraries in the library. I can't even assure you the support libraries maintain backward compatibility. Here is the example that they don't.
I know that The support library should not use a different version than the compileSdkVersion.
That is only a suggestion. However, you should conform to it, but you don't have to.
I see some examples use
compile 'com.android.support:appcompat-v7:21.0.3'
and some show:
compile 'com.android.support:support-v7:21.0.3'
What is the difference between these two libraries?
v4 support library
This library is designed to be used with Android 1.6 (API level 4) 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 appcompat library
This library adds support for the Action Bar user interface design pattern. This library includes support for material design user interface implementations.
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.
Source: https://developer.android.com/tools/support-library/features.html
AppCompat (At first ActionBarCompat) started out as a backport of the Android 4.0 ActionBar API for devices running on Gingerbread, providing a common API layer on top of the backported implementation and the framework implementation. AppCompat v21+ delivers an API and feature-set that is up-to-date with Android 5.0 like some material styles and themes as well as some Android 5 components like cardview and palette library.
As you can see AppCompat is mostly about making new android app design concept available in older versions.
Support Library on the other hand tries to provide functionalities of new version of android in older versions like fragments. It also has some useful classes which are not present in any version of android like ViewPager, LruCache and LocalBroadcastManager.
I want to use ActionBar.setHomeAsUpIndicator(drawable), but it's only available from api 18 onwards:
http://developer.android.com/reference/android/app/ActionBar.html#setHomeAsUpIndicator(android.graphics.drawable.Drawable)
It seems available in the compatibility library from v7 onwards?:
http://developer.android.com/reference/android/support/v7/app/ActionBar.html#setHomeAsUpIndicator(android.graphics.drawable.Drawable)
I'm not using any of the compatibility libraries, though, since I was targeting only api 14 and higher. Reading this article I thought that was ok to do:
http://developer.android.com/training/basics/actionbar/setting-up.html
So now do I have to restructure everything to use the compatibility library and have all my activities extend from ActionBarActivity? Please let it be no.
Thanks
While the main reason to use the compatibility library is to run on pre-11 versions, there are always new features added and the compatibility library also addresses those differences. For example, there's a bunch of features that were added in 14 but not in 11, the compatibility library backports those to 11 as well as 7.
Since this feature is v18+ only, if you want to use it, you have to use the compatibility library. Or just drop the feature.
I have created a new android project in Eclipse, and I have setted this configuration:
Minimum required SDK: API 7
Target SDK: API 18
Compile with: API 18
Theme: Holo Light
So, my application has the actionbar. Eclipse has automatically included only android-support-v4.jar.
But, since ActionBar class is included in the support library for compatibility with API level 7 and higher. I am wondering why in my project are included only android-support-v4 library.
I guess that if I don't include v7 appcompat library I can continue to show the actionbar in my application, but I can't manage or customize it using ActionBar API? Is this right?
Quoting from the docs
The ActionBar APIs were first added in Android 3.0 (API level 11) but they are also available in the Support Library for compatibility with Android 2.1 (API level 7) and above.
http://developer.android.com/guide/topics/ui/actionbar.html
If you want your app to support action bar below 3.0 you need to use app compact v7 from the support library.
Also check the below link
http://android-developers.blogspot.in/2013/08/actionbarcompat-and-io-2013-app-source.html
you need to understand some of the very basic things.
1) Support libraries are meant to support functionalities in previous versions. you need to manually setup your project(addition in build path etc) to use support libraries.
2) If you dont use support library v7 in this case, You can show action bar, can customize it and do whatever it is supported in the version(3.0) ActionBar supported in.
3) If you want to show Action Bar in suppose Api levels 8/7(2.2/2.1), you must use support libraries v7.
Here is how to create action bars and support it lower versions
Please dont forget to use/imports classes/apis from support library instead of SDKs classes.
Tutorial is easy enough to understand.
1) Support libraries are meant to support functionalities in previous versions and add functionalities that only exists in these libraries. You need to manually setup your project(addition in build path etc) to use support libraries.