Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Get App-Name from Intent

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.

like image 305
schlingel Avatar asked May 09 '11 12:05

schlingel


People also ask

How do you get an app name?

Find an Android app nameGo to the Google Play Store for Apps. Search by app name. Click the result for your app.

How to use intent filter in android?

An intent filter is an expression in an app's manifest file that specifies the type of intents that the component would like to receive. For instance, by declaring an intent filter for an activity, you make it possible for other apps to directly start your activity with a certain kind of intent.

What is the difference between intent and intent filter in android?

An intent is an object that can hold the os or other app activity and its data in uri form.It is started using startActivity(intent-obj).. \n whereas IntentFilter can fetch activity information on os or other app activities.


1 Answers

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

like image 82
CommonsWare Avatar answered Sep 18 '22 08:09

CommonsWare