I’m trying to sort an ArrayList in my Android app, but its throwing an exception. Here’s the part of my code where it happens:
List<PackageInfo> packs = getPackageManager().getInstalledPackages(0);
Collections.sort(packs);
Does anybody have any ideas?
packs contains PackageInfo objects, and sort can not find a natural order for those is my best guess. If you want to sort, use a Comparator with the sort which defines what you want to sort the PackageInfo objects on.