Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; public class Main { public static String getVersionName(Context context) throws PackageManager.NameNotFoundException { PackageManager packageManager = context.getPackageManager(); PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), PackageManager.GET_ACTIVITIES); return packageInfo.versionName; } }