How to retrieve the android sdk version?

时光怂恿深爱的人放手 提交于 2019-11-26 05:52:41

问题


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


回答1:


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.




回答2:


  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()); 


来源:https://stackoverflow.com/questions/1882883/how-to-retrieve-the-android-sdk-version

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!