Skip to content

Instantly share code, notes, and snippets.

@duongnv1996
Created July 24, 2016 17:43
Show Gist options
  • Save duongnv1996/afb9a1f08e617106e57d7710c32e64b1 to your computer and use it in GitHub Desktop.
Save duongnv1996/afb9a1f08e617106e57d7710c32e64b1 to your computer and use it in GitHub Desktop.
sort by alpha
private class ResolveInfoComparator implements Comparator<ResolveInfo> {
final PackageManager packageManager;
public ResolveInfoComparator(final PackageManager packageManager) {
this.packageManager = packageManager;
}
@Override
public int compare(final ResolveInfo resolveInfo, final ResolveInfo resolveInfo2) {
final String appLabel = resolveInfo.loadLabel(packageManager).toString();
final String appLabel2 = resolveInfo2.loadLabel(packageManager).toString();
return appLabel.compareTo(appLabel2);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment