在這裏你如何得到細節。由於您擁有軟件包名稱,因此可以使用它來獲取相應的應用程序名稱,版本和圖標。
List<PackageInfo> packagess = getPackageManager().getInstalledPackages(0);
for(int i=0;i<packagess.size();i++) {
PackageInfo pack = packagess.get(i);
if ((!getSysPackages) && (pack.versionName == null)) {
continue ;
}
//this is the application name
pack.applicationInfo.loadLabel(getPackageManager()).toString();
//this is the package name
pack.packageName;
//this is the version name
pack.versionName;
//this is the version code
pack.versionCode;
//this is the application icon
pack.applicationInfo.loadIcon(getPackageManager());
}
爲了確保我能正確理解你,這個想法是循環遍歷已安裝的軟件包,尋找我從'top'命令獲得的軟件包,對不對?聽起來很美味,我會在下午檢查一下,下班後;) – Moyshe
@Moyshe是啊。你可以將它們保存在一個HashMap或任何你想要的。 –
它工作!非常感謝你! Ale這些學分是屬於你的;) – Moyshe