List<PackageInfo> pkginfoList = getPackageManager()
.getInstalledPackages(0);
How to Sort the PackageInfo, i did ApplicationInfo thats working fine
Collections.sort(installedList, new ApplicationInfo.DisplayNameComparator(packageManager));
but i want implement PackageInfo also..
i'm not sure how to do.. Please any one help me...!
Collections.sort method takes two parameters:
In your case you want to implement a Comparator<PackageInfo>. An example supposing a PackagInfo has a getName() method:
new Comparator<PackagInfo>() {
@Override
public int compare(PackagInfo arg0, PackagInfo arg1) {
return arg0.getName().compareTo(arg1.getName());
}
};
Another solution is to get one from somewhere but I don't know Android well. Looking at the piece of code you provided, maybe you have a PackageInfo.xxxx static field which type is Comparator<PackageInfo> ?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With