/** * 获取有关本程序的信息。 * * @return 有关本程序的信息。 */ public ApkInfo getApkInfo() { ApkInfo apkInfo = new ApkInfo(); ApplicationInfo applicationInfo = mContext.getApplicationInfo(); apkInfo.packageName = applicationInfo.packageName; apkInfo.iconId = applicationInfo.icon; apkInfo.iconDrawable = mResources.getDrawable(apkInfo.iconId); apkInfo.programName = mResources.getText(applicationInfo.labelRes).toString(); PackageInfo packageInfo = null; try { packageInfo = mContext.getPackageManager().getPackageInfo(apkInfo.packageName, 0); apkInfo.versionCode = packageInfo.versionCode; apkInfo.versionName = packageInfo.versionName; } catch (NameNotFoundException e) { log.w(e); } return apkInfo; }