How can I check the system version of Android?
有谁知道我可以检查系统版本(例如1.0
, 2.2
,等)编程?
Check android.os.Build.VERSION
.
CODENAME
: The current development codename, or the string "REL" if this is a release build. INCREMENTAL
: The internal value used by the underlying source control to represent this build. RELEASE
: The user-visible version string. 示例如何使用它:
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD) {
// only for gingerbread and newer versions
}
Build.Version is the place go to for this data. Here is a code snippet for how to format it.
public String getAndroidVersion() {
String release = Build.VERSION.RELEASE;
int sdkVersion = Build.VERSION.SDK_INT;
return "Android SDK: " + sdkVersion + " (" + release +")";
}
Looks like this "Android SDK: 19 (4.4.4)"
链接地址: http://www.djcxy.com/p/12994.html上一篇: 如何立即停止Java.util.Timer类中计划的任务
下一篇: 我如何检查Android的系统版本?