I was getting sick of updating the version number on multiple places in my app when releasing updates; "About" screen, "version" variable and then in the Android manifest.
Since the application manifest already had android:versionName, why not use it?
try {
MyActivity.GAME_VERSION = getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName;
}
catch (NameNotFoundException e) {
// I don't think this ever happens, but let me know if it does!
MyActivity.GAME_VERSION = "0.00";
}
So easy, should have looked it up earlier!
Now I'm laughing at version changes!