Skip to content Skip to sidebar Skip to footer

If I Set Minsdkversion As 8, But Want To Specify Some Methods For Sdkversion=15, How Can I Do That?

I want to develop an Android application even for android devices with a lower version, while I do not want to sacrifice some available functions in higher versions. In the Android

Solution 1:

You will want to add @SupressLint("NewApi") to your activity class. Then you will want to use android.os.Build.VERSION.SDK_INT; to get the version int, which should always be the API number (ie. Jelly Bean 4.2 is API 17, use 17 for your comparison) or you can use Build.VERSION_CODES.DESSERT_NAME_HERE, and use this value for an if-else to perform your action that can only take place in higher level API's.

Solution 2:

I think it will be better if you change "minSdkVersion" to 15. Because it will easily die when run at pervious device.

Post a Comment for "If I Set Minsdkversion As 8, But Want To Specify Some Methods For Sdkversion=15, How Can I Do That?"