First, I would like to say this is my first post on StackOverflow, so I hope I am doing this right.
I am attempting to make an Android App that displays all of a user's apps. The issue that I'm having is that some apps are being shown multiple times. I do not know how to check the activities associated with the package, but I think it is a similar situation to this:
Android: How to get a list of installed activities, as they appear in launcher, without duplicates
The Intent Solution does not display any duplicates, but how would I use something similar to show in a GridView?
EDIT: Thank you for your quick response. This is the way that I already get the packages. I was not using the 0 flag, however. After substituting the 0 flag in, I still received duplicates. Is it something to do with the way GridView's work? I happen to notice that when I scroll down on the grid view and go back up, my list is in a different order.
CODE FOR PULLING THE APPS INTO A LIST:
ArrayList<ApplicationInfo> apps = (ArrayList<ApplicationInfo>) manager.getInstalledApplications(0); //manager is a variable containing getPackageManager
EDIT 2:
After using the following code to output the ArrayList:
for(int i = 0; i < apps.size(); i++){
Log.i((String) apps.get(i).loadLabel(manager), apps.get(i).packageName);
}
I am able to conclude that there are no duplicates in the array. However, they somehow appear in the gridview.
FINAL EDIT:
The top answer on this question ended up solving the GridView issue: