This is a little snippet to fetch the versionName from the AndroidManifest.xml
public static String getVersionName(Context context)
{
try {
ComponentName comp = new ComponentName(context, context.getClass());
PackageInfo pinfo = context.getPackageManager().getPackageInfo(comp.getPackageName(), 0);
return pinfo.versionName;
} catch (android.content.pm.PackageManager.NameNotFoundException e) {
return null;
}
}