有没有办法在android中猜测包名?

时间:2017-03-21 22:21:02

标签: android

在所有包名中,我希望它只显示一个包名,其中包含" 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();

0 个答案:

没有答案