I want to know how to parse the AndroidManifest.xml file in order to get the Application Version Number through code. android:versionName
No need to parse the AndroidManifest.xml
file for this.
You can get this by using:
try
{
String app_ver = this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName;
}
catch (NameNotFoundException e)
{
Log.e(tag, e.getMessage());
}
Use this inside your onCreate()
method.