For example, the API version is greater than 19 (i.e. android4.4)
if (build.version.sdk_int>=build.version_codes. Kitat) {}
Version information under the Build.version_codes class (this is the source code in the android.jar4.4.2 version)
public static class Version_codes {
/**
* Magic version number for a current development build, which have
* Not yet turned to an official release.
*/
public static final int cur_development = 10000;
/**
* October 2008:the Original, first, version of Android. yay!
*/
public static final int BASE = 1;
/**
* February 2009:first Android Update, officially called 1.1.
*/
public static final int base_1_1 = 2;
/**
* May 2009:android 1.5.
*/
public static final int cupcake = 3;
/**
* September 2009:android 1.6.
*/
public static final int donut = 4;
/**
* November 2009:android 2.0
*/
public static final int eclair = 5;
/**
* December 2009:android 2.0.1
*/
public static final int eclair_0_1 = 6;
/**
* January 2010:android 2.1
*/
public static final int eclair_mr1 = 7;
/**
* June 2010:android 2.2
*/
public static final int FROYO = 8;
/**
* November 2010:android 2.3
*/
public static final int gingerbread = 9;
/**
* February 2011:android 2.3.3.
*/
public static final int gingerbread_mr1 = 10;
/**
* February 2011:android 3.0.
*/
public static final int honeycomb = 11;
/**
* May 2011:android 3.1.
*/
public static final int honeycomb_mr1 = 12;
/**
* June 2011:android 3.2.
*/
public static final int HONEYCOMB_MR2 = 13;
/**
* October 2011:android 4.0.
*/
public static final int ice_cream_sandwich = 14;
/**
* December 2011:android 4.0.3.
*/
public static final int ice_cream_sandwich_mr1 = 15;
/**
* June 2012:android 4.1.
*/
public static final int jelly_bean = 16;
/**
* Android 4.2:moar Jelly beans!
*/
public static final int jelly_bean_mr1 = 17;
/**
* Android 4.3:jelly Bean MR2, the Revenge of the beans.
*/
public static final int jelly_bean_mr2 = 18;
/**
* Android 4.4:kitkat, another tasty treat.
*/
public static final int KITKAT = 19;
}
public static class Version_codes {/** * Magic VERSION number to a current development build, which have * Not yet turned to an official release. */public static final int cur_development = 10000; /** * October 2008:the Original, first, version of Android. yay! */public static final int BASE = 1; /** * February 2009:first Android Update, officially called 1.1. */public static final int base_1_1 = 2; /** * May 2009:android 1.5. */public static final int cupcake = 3; /** * September 2009:android 1.6. */public static final int donut = 4; /** * November 2009:android 2.0 */public static final int eclair = 5; /** * December 2009:android 2.0.1 */public static final int eclair_0_1 = 6; /** * JAnuary 2010:android 2.1 */public static final int eclair_mr1 = 7; /** * June 2010:android 2.2 * * public static final int FROYO = 8; /** * November 2010:android 2.3 */public static final int gingerbread = 9; /** * February 2011:android 2.3.3. */public static final int gingerbread_mr1 = 10; /** * February 2011:android 3.0. */public static final int honeycomb = 11; /** * May 2011:android 3.1. */public static final int honeycomb_mr1 = 12; /** * June 2011:android 3.2. */public static final int HONEYCOMB_MR2 = 13; /** * October 2011:android 4.0. */public static final int ice_cream_sandwich = 14; /** * December 2011:android 4.0.3. */public static final int ice_cream_sandwich_mr1 = 15; /** * June 2012:android 4.1. */public static final int jelly_bean = 16; /** * Android 4.2:moar Jelly beans! */public static final int jelly_bean_mr1 = 17; /** * Android 4.3:jelly Bean MR2, the Revenge of the beans. */public static final int jelly_bean_mr2 = 18; /** * Android 4.4:kitkat, another tasty treat. */public static final int KITKAT = 19; }
ANDROID API version judgment