Android examples for App:App Information
get App Simple Version
//package com.java2s; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; public class Main { private static String appSimpleVersion; public static String getAppSimpleVersion(Context context) { if (null == appSimpleVersion || appSimpleVersion.trim().length() == 0) { PackageManager packageManager = context.getPackageManager(); try { PackageInfo packageInfo = packageManager.getPackageInfo( context.getPackageName(), 0); appSimpleVersion = packageInfo.versionName; } catch (Exception e) { e.printStackTrace();// www .j av a2 s. co m } } return appSimpleVersion; } }