I have the following code:
packageManager = getPackageManager();
List<PackageInfo> packageList = packageManager.getInstalledPackages(PackageManager.GET_PERMISSIONS);
List<PackageInfo> installedapps = new ArrayList<PackageInfo>();
for(PackageInfo apps: packageList){
if(!isSystemPackage(apps)){
installedapps.add(apps);
}
}
Collections.sort(installedapps, new Comparator<PackageInfo>(){
public int compare(PackageInfo o1, PackageInfo o2) {
return o1.packageName.compareTo(o2.packageName);
}
});
apkList = (ListView) findViewById(R.id.listView);
apkList.setAdapter(new AppInfoAdapter(this, installedapps, packageManager));
installedapps is a list of all the apps on the device minus the system apps. The only thing I want to do is sort them alphabetically, can't quite figure out how.