-1

i'm making a launcher app and i would like to know how to selectively display apps on my launcher based on user input. Like other launchers will show all the apps normally, but in my launcher the user can, if they want, choose not to show some apps.

So how would i call PackageManager to show/not show a few select apps?

My current way is-

  1. Query all apps from PackageManager and keep it in a <ResolveInfo> list
  2. Keep the apps not to show in another <ResolveInfo> list
  3. Subtract the lists and pass the new list to populate my launcher

I need help in step 3

  • I can save somewhere list of ids of applications that user doesn't want to see. For example, in database. Let me now, why this approach will not help you, if it won't. And we try to think again. :) – Michael Spitsin May 07 '17 at 06:53

1 Answers1

0

You can use this code to compare user selected app to hide with installed app and generate new list to show in your launcher:

List<PackageInfo> packageInfos=getPackageManager().getInstalledApplications();
    List<PackageInfo> newList=new ArrayList<>();
    for (PackageInfo packs:
         packageInfos) {
        if(!packs.packageName.equals("User input package name"))
            newList.add(packs);
    }
Behzad Ashrafian
  • 267
  • 5
  • 17