wufoo
wufoo

Reputation: 14571

How to obtain android:versionName from Manifest?

I would like to display the android:versionName from AndroidManifest in my applications Info (About) page. Any way to do that?

Upvotes: 1

Views: 176

Answers (2)

Robin Chander
Robin Chander

Reputation: 7415

android:versionName="@string/verName"

Get version name in the code as follows

String version = getResources().getString(R.string.verName);

Upvotes: 7

Jin35
Jin35

Reputation: 8612

    try {
        PackageInfo pi = getPackageManager().getPackageInfo(getPackageName(), 0);
        version = pi.versionName;
    } catch (NameNotFoundException e) {
        version = "1.0";
    }

Upvotes: 3

Related Questions