android-api-levels

If I set minAPI to 21, do I need AppCompat?

做~自己de王妃 提交于 2019-12-01 03:11:35
问题 I decided to make my minimum API version 21 for Android, but does this mean it makes no sense to use the AppCompat anymore? Just use plain Material Design / no AppCompat / etc? 回答1: No, you should always use AppCompat. This ensures that your app is already consistent across all API levels and you have access to all new APIs (such as using the Colored buttons, which was only introduced in API 23). Many other libraries, such as the Design Support Library also require use of AppCompat. 回答2: The

What is alternative to ConnectivityManager.TYPE_WIFI deprecated in Android P API 28?

允我心安 提交于 2019-12-01 00:02:31
问题 ConnectivityManager.TYPE_WIFI is deprecated in Android P API 28. Also, NetworkInfo#getType and ConnectivityManager.TYPE_MOBILE's are also deprecated. So, what are the alternatives for them? I understood that the we've to use the method from NetworkCapabilities class. However I'm not able to merge all the things in one place like how to do getType() in NetworkCapabilities class and how to add the WIFI and cellular data checks on it? Please assist. 回答1: ConnectivityManager.TYPE_WIFI is

Android - Tinting ProgressBar on pre-Lollipop devices

主宰稳场 提交于 2019-11-30 12:21:08
My app's minimum API-level is 19 (KitKat), and contains a layout with a horizontal ProgressBar . I'm using android:progressTint attribute to tint the bar to a custom color. It works pretty well on Lollipop (API 21) and above, but below (for example on API 19) it doesn't; it shows up in a different color. The reason is that this attribute is only used in API level 21 and higher as Android Studio states. So I'm wondering what can be a good alternative for tinting the ProgressBar on pre-Lollipop devices, too. Can it be made inside the layout file with XML? Or should this be done on a different

What is the android api for getting the list of connected audio devices?

梦想与她 提交于 2019-11-30 11:13:50
I used the below added code to get the connected audio devices for android device. Used AudioManager api method getDevices() and got the result with connected devices like earphones, speaker, headphones. But this getDevices() method is available since android api level 23 (Marshmallow) only. But my application should support from api level 21 (Lollipop). Please can anybody let me know the alternative api to get the available audio device for the android device. Code used with api level 23. AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); if (android.os.Build

Android Studio Suddenly started to display unable to resolve com.android.support…25.0.0 error messages and all of my java files are erroneous now?

空扰寡人 提交于 2019-11-30 07:59:16
问题 My project was working very fine, but until one day, when I uploaded my project to github. I don't know if this issue is related to that but today when I compiled my android studio project, it started showing me these 4 horrible errors. I have tried most of the google results but no help! Error:Failed to resolve: com.android.support:cardview-v7:25.0.0 Error:Failed to resolve: com.android.support:customtabs:25.0.0 Error:Failed to resolve: com.android.support:appcompat-v7:25.0.0 Error:Failed to

What is the android api for getting the list of connected audio devices?

倾然丶 夕夏残阳落幕 提交于 2019-11-29 16:53:00
问题 I used the below added code to get the connected audio devices for android device. Used AudioManager api method getDevices() and got the result with connected devices like earphones, speaker, headphones. But this getDevices() method is available since android api level 23 (Marshmallow) only. But my application should support from api level 21 (Lollipop). Please can anybody let me know the alternative api to get the available audio device for the android device. Code used with api level 23.

Android Studio Suddenly started to display unable to resolve com.android.support…25.0.0 error messages and all of my java files are erroneous now?

纵饮孤独 提交于 2019-11-29 05:32:21
My project was working very fine, but until one day, when I uploaded my project to github. I don't know if this issue is related to that but today when I compiled my android studio project, it started showing me these 4 horrible errors. I have tried most of the google results but no help! Error:Failed to resolve: com.android.support:cardview-v7:25.0.0 Error:Failed to resolve: com.android.support:customtabs:25.0.0 Error:Failed to resolve: com.android.support:appcompat-v7:25.0.0 Error:Failed to resolve: com.android.support:support-v4:25.0.0 This is the screenshot of android studio screen if it

How to Use Unsupported Exception for Lower Platform Version

末鹿安然 提交于 2019-11-29 01:44:06
I have a DialogFragment that handles login and fingerprint authentication for my application. This fragment uses two classes that are exclusive to API 23, KeyGenParameterSpec and KeyPermanentlyInvalidatedException . I had been under the impression that I could use these classes, as long as I check the build version before I try to initialize the classes (outlined here ): if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { ... } else { ... } But it appears that this is not the case. If I try to run this code on a version prior to API 20, the Dalvik VM rejects the entire class and throws a

Null URI on API level >=23 camera intent [duplicate]

℡╲_俬逩灬. 提交于 2019-11-28 14:50:52
This question already has an answer here: What is a NullPointerException, and how do I fix it? 12 answers This might be a possible duplicate but i can't seem to pinpoint the exact solution. Camera works fine and returns the image uri on devices below api 23. However app crushes right after capturing image on devices apove api 23 with log error java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=2, result=-1, data=Intent { act=inline-data (has extras) }} to activity {ana.foodi/ana.foodi.MainActivity}: java.lang.NullPointerException: uri at android.app

Error inflating class android.support.design.widget.FloatingActionButton in Android

我怕爱的太早我们不能终老 提交于 2019-11-28 12:43:24
When I'm trying to build the application it will show the android.view.InflateException in FloatingActionButton? I really don't know what causes the error. Login.xml <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" android:background="@drawable/bg_image" > <RelativeLayout android:layout_width=