Alphabetize List Of Installed Apps
I have a list of the users installed applications and want it to come out already alphabetized (not on dividers or anything like that just already alphabetized) I looked around but
Solution 1:
Not tested:
publicstatic ArrayList<ResolveInfo> getInstalledApplications(Context c) {
Intentintent=newIntent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
ArrayList<ResolveInfo> applist = c.getPackageManager().queryIntentActivities(intent, PackageManager.GET_ACTIVITIES);
Collections.sort(applist, newComparator<ResolveInfo>(){
publicintcompare(ResolveInfo emp1, ResolveInfo emp2) {
return emp1.loadLabel(pm).toString().compareToIgnoreCase(emp2.loadLabel(pm).toString());
}
});
return applist;
}
Post a Comment for "Alphabetize List Of Installed Apps"