Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android API Version programmatically [duplicate]

Tags:

android

Possible Duplicate:
Retrieving Android API version programmatically

I am trying to retrieve the current API Version of the device my Application is Running. Is there a way i can get that and Store it on a String. This needs to Work on 1.5 Version and Up. Examples would be greatly appreciated. Thank you.

like image 389
rbz Avatar asked Aug 17 '10 20:08

rbz


People also ask

How to retrieve Android API version programmatically?

This example demonstrates how do I retrieve android API version programmatically. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main.xml. Step 3 − Add the following code to src/MainActivity.java

How do I find the API level of an Android app?

You can easily find the mapping from api level to android version in the android documentation. I believe, 8 is for 2.2, 7 for 2.1, and so on. Show activity on this post.

How to create a new project in Android Studio?

Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.

How to run the app from Android Studio?

To run the app from android studio, open one of your project's activity files and click Run icon from the toolbar. Select your mobile device as an option and then check your mobile device which will display your default screen −


1 Answers

You can get it by calling Build.VERSION.SDK.

From 1.6 on, you should use Build.VERSION.SDK_INT instead
because Build.VERSION.SDK is deprecated.

like image 182
iandisme Avatar answered Sep 19 '22 06:09

iandisme