[android-developers] Re: Showing application version

2009-12-04 Thread Binh Nguyen
I follow the code below but it always show 'getPackageInfo() is undefined' error, anyone knows the reason. Thanks in advance On Oct 26, 9:19 pm, Greivin Lopez wrote: > Or just use the following code snippet: > > /** >  * Gets the softwareversionandversionname for this application >  */ >  privat

[android-developers] Re: Showing application version

2009-10-26 Thread Greivin Lopez
Or just use the following code snippet: /** * Gets the software version and version name for this application */ private void getSoftwareVersion() { try { PackageInfo pi = getPackageManager().getPackageInfo (getPackageName(), 0); // Store the software version code

[android-developers] Re: Showing application version

2009-10-26 Thread Greivin Lopez
Or just use the following code snippet: /** * Gets the software version and version name for this application */ private void getSoftwareVersion() { try { PackageInfo pi = getPackageManager().getPackageInfo (getPackageName(), 0); // Store the software version code

[android-developers] Re: Showing application version

2009-10-26 Thread TreKing
Yeah, look for PackageInfo.versionName and PackageInfo.versionCode. You can get an instance of PackageInfo from PackageManager.getPackageInfo(), and you can get THAT from your Activity through getPackageManager(). On Oct 25, 6:14 am, matteoli wrote: > I would like to show the current version of