Get API level programmatically

The SDK level (integer) running is available in android.os.Build.VERSION.SDK_INT.

int currentapiVersion = android.os.Build.VERSION.SDK_INT;

You can then use the int value or the enum corresponding to this int in the android.os.Build.VERSION_CODES class.

if (currentapiVersion >= 18)
or
if (currentapiVersion >= android.os.Build.VERSION_CODES.FROYO)

 

This entry was posted in Android. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *