@SuppressLint("NewApi")
if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.Honeycomb)
{
//如果api版本 大于11
}else{
//如果api版本 小于11
}
Android版本名和API Level关系全称
Android的版本
Android版本名称Code name
Android的API level
Android 1.0 (API level 1)
1.0
(no code name)
API level 1
Android 1.1 (API level 2)
1.1
(no code name)
API level 2
Android 1.5 Cupcake (API level 3)
1.5
Cupcake
API level 3, NDK 1
Android 1.6 Donut (API level 4)
1.6
Donut
API level 4, NDK 2
Android 2.0 Eclair (API level 5)
2.0
Eclair
API level 5
Android 2.0.1 Eclair (API level 6)
2.0.1
Eclair
API level 6
Android 2.1 Eclair (API level 7)
2.1
Eclair
API level 7, NDK 3
Android 2.2–2.2.3 Froyo (API level 8)
2.2.x
Froyo
API level 8, NDK 4
Android 2.3–2.3.2 Gingerbread (API level 9)
2.3 – 2.3.2
Gingerbread
API level 9, NDK 5
Android 2.3.3–2.3.7 Gingerbread (API level 10)
2.3.3 – 2.3.7
Gingerbread
API level 10
Android 3.0 Honeycomb (API level 11)
3.0
Honeycomb
API level 11
Android 3.1 Honeycomb (API level 12)
3.1
Honeycomb
API level 12, NDK 6
Android 3.2 Honeycomb (API level 13)
3.2.x
Honeycomb
API level 13
Android 4.0–4.0.2 Ice Cream Sandwich (API level 14)
4.0.1 – 4.0.2
Ice Cream Sandwich
API level 14, NDK 7
Android 4.0.3–4.0.4 Ice Cream Sandwich (API level 15)
4.0.3 – 4.0.4
Ice Cream Sandwich
API level 15, NDK 8
Android 4.1 Jelly Bean (API level 16)
4.1.x
Jelly Bean
API level 16
Android 4.2 Jelly Bean (API level 17)
4.2.x
Jelly Bean
API level 17
Android 4.3 Jelly Bean (API level 18)
4.3.x
Jelly Bean
API level 18
Android 4.4 KitKat (API level 19)
4.4
KitKat
API level 19
Android 5.0 (API Level 21) 5.0 LOLLIPOP API Level 21