views:

129

answers:

1

Is there a simple way to find the current version of my application from with it? I would like to add the version string to the about screen.

+4  A: 

You should check this question.

I am doing it this way:

try {
            String pkg = mContext.getPackageName();
            mVersionNumber = mContext.getPackageManager().getPackageInfo(pkg, 0).versionName;
        } catch (NameNotFoundException e) {
            mVersionNumber = "?";
        }
Macarse