标签:
目前开发的app中需要发送邮件,所以需要调用android默认的邮件客户端,并需要添加多个邮件附件,我该通过哪个组件调用默认的客户端?用什么组件来支持多个附件的电子邮件?
是通过下面的哪一个?
(
Intent.ACTION_SEND,
Intent.ACTION_SENDTO,
Intent.ACTION_SEND_MULTIPLE, ...
)?
过一遍android email的源代码,能在结尾发现如下代码
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
String subject = ...String text = ...ArrayList<uri> attachments = ...Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);intent.putExtra(Intent.EXTRA_SUBJECT, subject);intent.putExtra(Intent.EXTRA_TEXT, text);intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, attachments);intent.setClassName(com.android.email, com.android.email.activity.MessageCompose);try {startActivity(intent);} catch (ActivityNotFoundException anfe) {anfe.printStackTrace();}上面的代码在 Android 4.0 到 Android 4.3时好用的,在Android 4.4 (KitKat) 版本中,activity的名字已经变成了 com.android.email.activity.ComposeActivityEmail, </uri> |
结伴旅游,一个免费的交友网站:www.jieberu.com
推推族,免费得门票,游景区:www.tuituizu.com
标签:
原文地址:http://www.cnblogs.com/rabbit-bunny/p/4190959.html