Android(安卓)获取版本号
Asdescribedintheandroiddocumentation,theSDKlevel(integer)thephoneisrunningisavailablein:
android.os.Build.VERSION.SDK_INT;
Theenumcorrespondingtothisintisintheandroid.os.Build.VERSION_CODESclass.
Codeexample:
intcurrentapiVersion=android.os.Build.VERSION.SDK_INT;
if(currentapiVersion>=android.os.Build.VERSION_CODES.FROYO){
//Dosomething
}else{
//dosomething
}
Note:
ThisSDK_INTisavailablesinceDonut(android1.6/API4)
somakesureyourapplicationisnotretro-compatiblewithCupcake(android1.5/API3)whenyouuseitoryourapplicationwillcrash(thankstoProgrammerBrucefortheprecision).
====================================================================================
Build.VERSION_CODES
1(0x00000001)Android1.0BASE
2(0x00000002)Android1.1BASE_1_1
3(0x00000003)Android1.5CUPCAKE
4(0x00000004)Android1.6DONUT
5(0x00000005)Android2.0ECLAIR
6(0x00000006)Android2.0.1ECLAIR_0_1
7(0x00000007)Android2.1ECLAIR_MR1
8(0x00000008)Android2.2FROYO
9(0x00000009)Android2.3GINGERBREAD
10(0x0000000a)Android2.3.3GINGERBREAD_MR1
11(0x0000000b)Android3.0HONEYCOMB
12(0x0000000c)Android3.1HONEYCOMB_MR1
13(0x0000000d)Android3.2HONEYCOMB_MR2
Build.VERSION_CODES
参考推荐:
Android 获取屏幕尺寸与密度
更多相关文章
- Android自定义对话框的使用
- Android自定义对话框的使用
- Android获取系统时间
- android版本号版本名
- Android(安卓)Logging System
- Android自定义对话框的使用
- Android天气预报详解
- android 数据储存——网络存储(5)
- 获取Android自己写好了的apk以及反编译