在所有包名中,我希望它只显示一个包名,其中包含" top20s"在里面。
我该怎么做?
// get all installed app package names and guess the package name
// you are trying to uninstall from apk name.
List<PackageInfo> packList = getPackageManager()
.getInstalledPackages(0);
for (int i = 0; i < packList.size(); i++) {
PackageInfo packInfo = packList.get(i);
if ((packInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
String listAllInstalledPackages = packInfo.applicationInfo
.loadLabel(getPackageManager()).toString();
Toast.makeText(getApplicationContext(),
listAllInstalledPackages, Toast.LENGTH_SHORT)
.show();