如何检索Android SDK版本?
我怎样才能以编程方式获得当前的Android SDK
版本(1.5,1.6,2.0等)?
String Build.VERSION.RELEASE
会给你用户可见的版本string(即Build.VERSION.SDK_INT
),而Build.VERSION.SDK_INT
会给你一个来自Build.VERSION_CODES
的值,如果你想要通过编程比较。
StringBuffer buf = new StringBuffer(); buf.append("VERSION.RELEASE {"+Build.VERSION.RELEASE+"}"); buf.append("\\nVERSION.INCREMENTAL {"+Build.VERSION.INCREMENTAL+"}"); buf.append("\\nVERSION.SDK {"+Build.VERSION.SDK+"}"); buf.append("\\nBOARD {"+Build.BOARD+"}"); buf.append("\\nBRAND {"+Build.BRAND+"}"); buf.append("\\nDEVICE {"+Build.DEVICE+"}"); buf.append("\\nFINGERPRINT {"+Build.FINGERPRINT+"}"); buf.append("\\nHOST {"+Build.HOST+"}"); buf.append("\\nID {"+Build.ID+"}"); Log.d("build",buf.toString());