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 <[email protected]> wrote: > Or just use the following code snippet: > > /** > * Gets the softwareversionandversionname for this application > */ > private void getSoftwareVersion() { > try { > PackageInfo pi = getPackageManager().getPackageInfo > (getPackageName(), 0); > // Store the softwareversioncode andversionname > somewhere.. > Global.softwareVersion = pi.versionCode; > Global.softwareVersionText = > pi.versionName; > } catch (PackageManager.NameNotFoundException e) { > Log.e(TAG, "Package name not found", e); > }; > } > > Good luck with your Android programming! :) -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

