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