引用:http://kb.cnblogs.com/a/2331026/
try {
2
3 packagemanager pm = getPackageManager();
4
5 PackageInfo pinfo = pm.getPackageInfo(gerPackageName(), PackageManager.GET_CONFIGURATIONS);
6 String versionCode = pinfo.versionName;
7 Strint versionName = pinfo.versionCode;
8 } catch (NameNotFoundException e) {
9 }