Is there a simple way to find the current version of my application from within it? I would like to add the version string to the about screen.
You should check this question.
I am doing it this way:
try { String pkg = mContext.getPackageName(); mVersionNumber = mContext.getPackageManager().getPackageInfo(pkg, 0).versionName; } catch (NameNotFoundException e) { mVersionNumber = "?"; }
please try out this.
PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0); version = pInfo.versionName;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With