如何创建使用软件包管理器应用程序列表中选择器 [英] How to create a chooser for a list of applications using package manager
问题描述
基本上我对流行的电子邮件应用程序包的名单,我想创建一个选择器,启动发送电子邮件的意图,你可以参考的这个
问题,在这里他使用的包管理器只是Gmail的,我想这样做的软件包列表
我想要做的是模拟桌面行为,当你点击它打开展望/ Gmail客户端与到字段设置为电子邮件ID电子邮件链接,但除了这一点,我希望让用户选择电子邮件应用程序启动
块引用>startActivity(新意图(Intent.ACTION_SENDTO)
.setData(Uri.parse(电子邮件地址:+ yourEmailAddressGoesHere)));在这里你替换
yourEmailAddressGoesHere
与电子邮件ID。如果用户有多个电子邮件客户端,用户没有选择一个默认的电子邮件客户端,用户将自动获得一个选择器。如果用户只有一个电子邮件客户端,或者选择一个默认的电子邮件客户端,这将导致用户的一些活动,撰写邮件到您指定的电子邮件地址。
Basically I have a list of package names for popular email apps, and I want to create a chooser to launch the send email intent, you can refer to this question, here he uses the package manager for just gmail, I want to do it for a list of packages
解决方案What I want to do is simulate the desktop behavior when you click on an email link which opens outlook/gmail client with the to field set to the email id, but in addition to this I want to let the user choose the email application that is launched
startActivity(new Intent(Intent.ACTION_SENDTO) .setData(Uri.parse("mailto:"+yourEmailAddressGoesHere)));
where you replace
yourEmailAddressGoesHere
with "the email id".If the user has more than one email client, and the user has not chosen a default email client, the user will get a chooser automatically. If the user has only one email client, or has chosen a default email client, this will lead the user to some activity to compose a message to your designated email address.
这篇关于如何创建使用软件包管理器应用程序列表中选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!