Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6825847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:04:46+00:00 2026-05-26T22:04:46+00:00

Hi I followed the below tutorial and successfully listed all of my installed apps

  • 0

Hi I followed the below tutorial and successfully listed all of my installed apps in my application.

List all installed apps in style

However it does not list them alphabetically and i can not figure out how to sort them so that they are. Any help with this would be greatly appreciated. I’ve tried a few things like this

class IgnoreCaseComparator implements Comparator<String> {
            public int compare(String strA, String strB) {
                return strA.compareToIgnoreCase(strB);
            }
        }
        IgnoreCaseComparator icc = new IgnoreCaseComparator();
        java.util.Collections.sort(SomeArrayList,icc);

But can’t figure out how to apply it to the app list titles. Thank you for any help with this

===EDIT===

Thank you for the reply I did the following but have an error on sort. The error reads “The method sort(List, Comparator) in the type Collections is not applicable for the arguments (List, ApplicationInfo.DisplayNameComparator)”

   private List<App> loadInstalledApps(boolean includeSysApps) {
      List<App> apps = new ArrayList<App>();

      PackageManager packageManager = getPackageManager();

      List<PackageInfo> packs = packageManager.getInstalledPackages(0); 

      for(int i=0; i < packs.size(); i++) {
         PackageInfo p = packs.get(i);
         ApplicationInfo a = p.applicationInfo;
         if ((!includeSysApps) && ((a.flags & ApplicationInfo.FLAG_SYSTEM) == 1)) {
            continue;
         }
         App app = new App();
         app.setTitle(p.applicationInfo.loadLabel(packageManager).toString());
         app.setPackageName(p.packageName);
         app.setVersionName(p.versionName);
         app.setVersionCode(p.versionCode);
         CharSequence description = p.applicationInfo.loadDescription(packageManager);
         app.setDescription(description != null ? description.toString() : "");
         apps.add(app);
      }
      Collections.sort(apps, new ApplicationInfo.DisplayNameComparator(packageManager));
      return apps;
   }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:04:46+00:00Added an answer on May 26, 2026 at 10:04 pm

    When you query Android to get the list of installed applications, you will get a List<ApplicationInfo>. Android supplies an ApplicationInfo.DisplayNameComparator for those:

    Collections.sort(apps, new ApplicationInfo.DisplayNameComparator(pm)); 
    

    (where pm is an instance of PackageManager).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I followed this tutorial to implement facebook into my application. All I want is
I followed this link to make use of recent files list but statement below
I have successfully followed Ryan Bates tutorial of paperclip and have it working correctly.
i followed this excellent as3 preloader tutorial, and below is the code i have
I followed below tutorial and built one whole complete app. http://www.tonyamoyal.com/2010/07/28/rails-authentication-with-devise-and-cancan-customizing-devise-controllers/ http://www.tonyamoyal.com/2010/09/29/rails-authentication-with-devise-and-cancan-part-2-restful-resources-for-administrators/comment-page-2/#comment-879 All is
I've followed the tutorial below, it basically just tells you to create a button
I followed the Vogella RCP Tutorial and created an Application, lloking like that: The
I created a basic application shell with AppFuse, and followed the AppFuse tutorial to
I have followed the tutorial below to use CAGradientLayer to make gradient background in
i followed all of these steps in this tutorial: Created a validator class public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.