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 and version name
somewhere..
            Global.softwareVersion = pi.versionCode;
            Global.softwareVersionText =
pi.versionName;
        } catch (PackageManager.NameNotFoundException e) {
            Log.e(TAG, "Package name not found", e);
        };
    }

Good luck good 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to