Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.content.pm.PackageManager; public class Main { /** * get version name. */ public static String getVerName(Context context) { String verName = ""; try { String packageName = context.getPackageName(); verName = context.getPackageManager().getPackageInfo(packageName, 0).versionName; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } return verName; } }