Reputation: 14571
I would like to display the android:versionName from AndroidManifest in my applications Info (About) page. Any way to do that?
Upvotes: 1
Views: 176
Reputation: 7415
android:versionName="@string/verName"
Get version name in the code as follows
String version = getResources().getString(R.string.verName);
Upvotes: 7
Reputation: 8612
try {
PackageInfo pi = getPackageManager().getPackageInfo(getPackageName(), 0);
version = pi.versionName;
} catch (NameNotFoundException e) {
version = "1.0";
}
Upvotes: 3