Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; public class Main { public static PackageInfo getMyApkInfo(Context context) { PackageManager pm = context.getPackageManager(); PackageInfo apkInfo = null; try { apkInfo = pm.getPackageInfo(context.getPackageName(), 0); } catch (NameNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } return apkInfo; } }