Java tutorial
//package com.java2s; import android.app.Activity; import android.content.pm.PackageInfo; public class Main { public static int getVersionNumber(Activity act) { int versionCode = -1; try { PackageInfo packageInfo = act.getPackageManager().getPackageInfo(act.getPackageName(), 0); versionCode = packageInfo.versionCode; } catch (Exception ex) { System.out.println("Version Num : " + ex); } return versionCode; } }