13

I'm currently working on a multi image picker control. I'm using this Allow user to select camera or gallery for image solution for generating a list of possible intents from which the user picks one.

As seen here:

List<ResolveInfo> listGall = packageManager.queryIntentActivities(gallIntent, 0);
for (ResolveInfo res : listGall) {
    final Intent finalIntent = new Intent(gallIntent);
    finalIntent.setComponent(new ComponentName(res.activityInfo.packageName,     res.activityInfo.name));
yourIntentsList.add(finalIntent);
}

But all names I can resolve by ResolveInfo and its properties are not user friendly labels. So I'm looking for way to get the launcher name for the given activities.

Community
  • 1
  • 1
schlingel
  • 8,560
  • 7
  • 34
  • 62

1 Answers1

33

Use loadLabel() on the ResolveInfo to get a "user friendly label". Here is a sample app that demonstrates this.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • 2
    Cool! Works, thank you! ResolveInfo also contains loadIcon so when you use a custom dialog (http://developer.android.com/guide/topics/ui/dialogs.html) you're able to build a dialog with the launcher names and the icons. – schlingel May 09 '11 at 19:37