我有这个片段。`和路径| 是 APK 的位置。
PackageInfo info = getPackageManager().getPackageArchiveInfo(andPath, 0);
ApplicationInfo appinfo = info.applicationInfo;
String packageName = getPackageManager().getApplicationLabel(appinfo).toString();
PackageManager pm=getPackageManager();
ApplicationInfo ai;
try {
ai = pm.getApplicationInfo(packageName, 0);
} catch (final NameNotFoundException e) {
ai = null;
}
final String applicationName = (String) (ai != null ? pm.getApplicationLabel(ai) : "(unknown)");
applicationName
将包名返回给我。
CharSequence c = pm.getApplicationLabel(pm.getApplicationInfo(info.processName,PackageManager.GET_META_DATA));
c
返回我null
。
有谁知道我在这里想念什么?