码迷,mamicode.com
首页 > 移动开发 > 详细

Android运行时识别API版本

时间:2015-04-03 10:52:28      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:

  1.  1 /**
     2 * 判断Android系统API的版本
     3 *
     4 * @return
     5 */
     6 publicstaticint getAPIVersion(){
     7     intAPIVersion;
     8     try{
     9       APIVersion=Integer.valueOf(android.os.Build.VERSION.SDK);
    10     }catch(NumberFormatException e){
    11     APIVersion=0;
    12     }
    13     returnAPIVersion;
    14 }

     

我们一般用currentVersion < android.os.Build.VERSION_CODES.FROYO的方式进行判断是2.2以下版本



Android运行时识别API版本

标签:

原文地址:http://www.cnblogs.com/fruitbolgs/p/4389170.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!