Android examples for android.content.pm:App
get App Version Name
import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; public class Main { public static String getAppVersionName(Context context) { PackageManager packageManager = context.getPackageManager(); PackageInfo packInfo = null;/* w w w .j ava 2s . c o m*/ try { packInfo = packageManager.getPackageInfo(context.getPackageName(), 0); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } String version = packInfo.versionName; return version; } }