tags:

views:

41

answers:

1

android:versionName specifically... Thanks!

+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