android:versionName specifically... Thanks!
views:
41answers:
1
+1
A:
You can use the PackageInfo
class. Something along the lines of:
PackageInfo myInfo;
myInfo = getPackageManager().getPackageInfo(getPackageName(), 0)
version = myInfo.versionName;
getPackageName()
returns the full name of your package (the one that called it). If you were looking to find version information on a different package, you might want to wrap this in a try {...} catch
block, in case the package you were looking for wasn't installed. There's an example of that here.
eldarerathis
2010-08-11 17:09:27