开发者

Android: Get App-Name from Intent

开发者 https://www.devze.com 2023-03-04 03:52 出处:网络
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 on

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) {
    f开发者_如何学运维inal 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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消