android html邮件 messagecompose,Android意图:发送附件附件的电子邮件

用户在尝试使用Android Intent发送带有多个XML文件附件的电子邮件时遇到问题。代码似乎没有错误,但邮件未成功附加文件。尝试了不同的文件路径,但结果相同。Logcat显示Intent已启动并显示了MessageCompose活动,但没有关于附件失败的错误信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我想通过eMail发送几个文件.我找到了这个

Android multiple email attachments using Intent但它确实有效,我没有收到任何错误消息.它只是不附加文件(我也尝试只发送一个文件,但我得到了相同的结果).

我有没有监督过什么?你有什么建议吗?

private static void email (Context context, String emailTo, String emailCC,

String subject, String emailText, List filePaths)

{

//need to "send multiple" to get more than one attachment

final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);

emailIntent.setType("text/xml");

emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,

new String[]{emailTo});

emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);

emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailText);

//has to be an ArrayList

ArrayList uris = new ArrayList();

//convert from paths to Android friendly Parcelable Uri's

for (String file : filePaths)

{

File fileIn = new File(file);

// Uri u = Uri.fromFile(fileIn);

Uri u = Uri.fromFile(new File(Environment.getExternalStorageDirectory(), "blabla.xml"));

Log.v("bla", "filepath: " +u.toString());

uris.add(u);

Uri b = Uri.fromFile(new File(Environment.getExternalStorageDirectory(), "blabla.es"));

uris.add(b);

Log.v("bla", "filepath: " +b.toString());

}

emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);

context.startActivity(emailIntent);

}

logcat的:

03-06 16:08:50.940: INFO/ActivityManager(69): Starting: Intent { act=android.intent.action.SEND_MULTIPLE typ=text/xml cmp=com.android.email/.activity.MessageCompose (has extras) } from pid 436

03-06 16:08:52.130: INFO/ActivityManager(69): Displayed com.android.email/.activity.MessageCompose: +1s118ms

03-06 16:08:52.470: WARN/IInputConnectionWrapper(436): showStatusIcon on inactive InputConnection

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值