Android获取版本号

  • Android,版本号,

类:android.os.Build.VERSION

常量:public static final SDK

常量:public static final int SDK_INT

说明:The user-visible SDK version of the framework; its possible values are defined in Build.VERSION_CODES

类:android.os.Build.VERSION_CODES

说明:Enumeration of the currently known SDK version codes. These are the values that can be found in SDK. Version numbers increment monotonically with each official platform release.

public static final int BASE

October 2008: The original, first, version of Android. Yay!

Constant Value: 1 (0x00000001)

......

public static final int ICE_CREAM_SANDWICH_MR1

Android 4.0.3.

Constant Value: 15 (0x0000000f)

Note:

This SDK_INT is available since Donut (android 1.6 / API4)

so make sure your application is not retro-compatible with Cupcake (android 1.5 / API3)when you use it or your application will crash(thanks to Programmer Bruce for the precision).

before 1.6, SDK can be used.

这是Android获取版本号的方法,以1.6之前通过Build.SDK获取版本的字符串,1.6之后用SDK_INT获取int值的版本号。总是感觉这样用得不是很爽,小细节的东西。

版本的迭代还是很快的。

相关文章

- EOF -

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处,尊重他人劳动。
转载请注明:文章转载自 Binkery 技术博客 [https://binkery.com]
本文标题: Android获取版本号
本文地址: https://binkery.com/archives/93.html

赞助商
网站统计
  • 网站运行:3286 天
  • 文章总数:737 篇
  • 网站统计