基于文件类型的应用程序选择对话框
我正在尝试创建一个对话框,它将显示打开给定文件类型的可用应用程序列表。
我一直在 stackoverflow 上查看一些解决相同问题的问题,但由于缺乏答案而迷失了方向。特别是我一直在研究这个问题:
在 Android 中,如何根据文件类型显示应用程序选择器?
我的后续问题是:
- 如何处理
List
? - 如何显示可用应用程序的名称和图标?
- 当用户选择一个应用程序时,如何根据所选项目的ResolveInfo启动它?
I'm trying to create a Dialog, which will display a list of availible applications to open a given filetype.
I've been looking at some question here on stackoverflow that work with the same issue, but I get lost due to lacking answer. In particular I've been looking at this question:
In Android, How can I display an application selector based on file type?
My follow-up question is then:
- What to do with the
List<ResolveInfo>
? - How can I display the availible applications with name and icon?
- When the user selects an application, how can I start it based on the ResolveInfo of the selected item?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了一个解决方案,它为我提供了可以打开给定 mimetype 的应用程序的完整列表。这不是最好的,因为我希望列表更具体,并且只有一些应用程序(例如,如果它是我想打开的 URL,则只会显示浏览器),但可以达到目的。
这是我所做的:
I found a solution, that gives me a full list of applications that can open a given mimetype. It's not the best, as I would like the list to be more specific and just a few applications (e.g. if it was an URL I wanted to open only browsers would show up) but serves the purpose.
Here is what I did: