Java tutorial
//package com.java2s; //License from project: Open Source License import android.app.Activity; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; public class Main { public static String getVersionName(Activity activity) { try { PackageInfo info = activity.getPackageManager().getPackageInfo(activity.getPackageName(), 0); return info.versionName; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); return ""; } } }