如何获取Android SDK的版本?版本、Android、SDK

2023-09-11 12:30:17 作者:难以忘记初次见你

我怎样才能获得当前 Android SDK中版本(1.5,1.6,2.0,等)编程?

How can I get the current Android SDK version(1.5, 1.6, 2.0, etc.) programmatically?

推荐答案

字符串 Build.VERSION.RELEASE 会给你的用户可见的版本字符串(如1.5, 1.6,2.0),而 Build.VERSION.SDK_INT 会给你从 Build.VERSION_值codeS 这将是更好地使用,如果你想反对它来比较编程。

The String Build.VERSION.RELEASE will give you the user-visible version string (i.e 1.5, 1.6, 2.0), while Build.VERSION.SDK_INT will give you a value from Build.VERSION_CODES that would be better to use if you want to compare against it programatically.