标签:data android return article 名称 catch turn 获取 ace
<span style="font-size:18px;">/** * 获取本地软件版本号 */ public static int getLocalVersion(Context ctx) { int localVersion = 0; try { PackageInfo packageInfo = ctx.getApplicationContext() .getPackageManager() .getPackageInfo(ctx.getPackageName(), 0); localVersion = packageInfo.versionCode; LogUtil.d("TAG", "本软件的版本号。。" + localVersion); } catch (NameNotFoundException e) { e.printStackTrace(); } return localVersion; } /** * 获取本地软件版本号名称 */ public static String getLocalVersionName(Context ctx) { String localVersion = ""; try { PackageInfo packageInfo = ctx.getApplicationContext() .getPackageManager() .getPackageInfo(ctx.getPackageName(), 0); localVersion = packageInfo.versionName; LogUtil.d("TAG", "本软件的版本号。。" + localVersion); } catch (NameNotFoundException e) { e.printStackTrace(); } return localVersion; }</span>
标签:data android return article 名称 catch turn 获取 ace
原文地址:http://www.cnblogs.com/mthoutai/p/7110449.html