Android:从Intent获取App-Name [英] Android: Get App-Name from Intent

查看:487
本文介绍了Android:从Intent获取App-Name的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在研究多图像选择器控件。我正在使用这个允许用户为图像选择相机或图库用于生成用户选择的可能意图列表的解决方案。

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.

如下所示:

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);
}

但我可以通过ResolveInfo及其属性解析的所有名称都不是用户友好的标签。所以我正在寻找获取给定活动的启动器名称的方法。

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.

推荐答案

使用 loadLabel () ResolveInfo 上获取用户友好标签。 这是一个示例应用,用于演示此内容。

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

这篇关于Android:从Intent获取App-Name的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆