get Android SDK Version and its name - Android android.os

Android examples for android.os:Build

Description

get Android SDK Version and its name

Demo Code

public class Main{

    /**//w  w  w .  j  ava 2s  .c om
     * get api level:
     *
     * Android 5.0      ->  21  LOLLIPOP
     * Android 4.4W     ->  20  KITKAT_WATCH
     * Android 4.4      ->  19  KITKAT
     * Android 4.3      ->  18  JELLY_BEAN_MR2
     * Android 4.2      ->  17  JELLY_BEAN_MR1
     * Android 4.1      ->  16  JELLY_BEAN
     * Android 4.0.3    ->  15  ICE_CREAM_SANDWICH_MR1
     * Android 4.0      ->  14  ICE_CREAM_SANDWICH
     * Android 3.2      ->  13  HONEYCOMB_MR2
     * Android 3.1      ->  12  HONEYCOMB_MR1
     * Android 3.0      ->  11  HONEYCOMB
     * Android 2.3.3    ->  10  GINGERBREAD_MR1
     * Android 2.3      ->  9   GINGERBREAD
     * Android 2.2      ->  8   FROYO
     * Android 2.1      ->  7   ECLAIR_MR1
     * Android 2.0.1    ->  6   ECLAIR_0_1
     * Android 2.0      ->  5   ECLAIR
     * Android 1.6      ->  4   DONUT
     * Android 1.5      ->  3   CUPCAKE
     * Android 1.1      ->  2   BASE_1_1
     * Android 1.0      ->  1   BASE
     *
     * @return SDK version
     */
    public static int getAndroidSDKVersion() {
        return android.os.Build.VERSION.SDK_INT;
    }

}

Related Tutorials