ANDROID API version judgment

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.