Android的邮件选择器 [英] Android email chooser
问题描述
我写一个应用程序,需要在每个事务结束时发送电子邮件。我做了以下内容:
I am writing an app that needs to send emails at the end of each transaction. I am doing the following:
Intent mail = new Intent(Intent.ACTION_SEND);
mail.setType("text/html");
mail.putExtra(Intent.EXTRA_EMAIL, new String[] { emailTo });
mail.putExtra(Intent.EXTRA_SUBJECT, "Send from Android");
mail.putExtra(Intent.EXTRA_TEXT, "Sent from Android");
startActivity(Intent.createChooser(mail,"Select Email Software..."));
我想这样做是pre-选择电子邮件软件并将其存储在一个设定。这样一来,该电子邮件被发送每次,它没有要求使用哪个电子邮件用户。我只是似乎无法弄清楚如何调用选择器,并获得选择的值。
What I would like to do is pre-select the email software and store it in a setting. That way, every time the email is being sent, it does not have to ask the user which email to use. I just can't seem to figure out how to invoke the chooser and get the selected value.
任何帮助将是很大的AP preciated。
Any help would be greatly appreciated.
推荐答案
您必须创建自己的选择器,这可能是一个 AlertDialog
使用调用的结果填充 queryIntentActivities()
在 PackageManager
。
You would have to create your own chooser, possibly as an AlertDialog
populated using the results of calling queryIntentActivities()
on PackageManager
.
这篇关于Android的邮件选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!