tags:

views:

21

answers:

2

Is there a way to get the api level ? eg. to an int. I want to make 1 version of an application but only use AnticipateOvershootInterpolator() to >3 Api level devices.

+2  A: 

You can use this constant: android.os.Build.VERSION.SDK_INT. It returns one of these values.

Cristian
@Cristian: `SDK_INT` was added in Android 1.6 (API level 4). For apps only supporting that API level or higher, `SDK_INT` is a great answer. However, in this case, the OP is asking to detect ">3 Api level devices", suggesting support for API level 3. In that case, using the older `SDK` string and converting it to an integer is the better solution.
CommonsWare
Yes... you are right. Thanks for the clarification!
Cristian
+5  A: 

Look at android.os.Build.VERSION.SDK (and android.os.Build.SDK.VERSION.SDK_INT for newer devices).

CommonsWare