标签:
public String getVersion(Context context){ PackageManager pm = null; PackageInfo packageInfo = null; try { pm = context.getPackageManager(); packageInfo = pm.getPackageInfo(context.getPackageName(), 0); return packageInfo.versionName; } catch (NameNotFoundException e) { e.printStackTrace(); }finally{ packageInfo = null; pm = null; } return context.getString(R.string.default_show_version); }
标签:
原文地址:http://www.cnblogs.com/cbooy/p/4741027.html