如何在Android上附加两个或多个文件到SEND操作 [英] How to attach two or more files to SEND action on Android

查看:112
本文介绍了如何在Android上附加两个或多个文件到SEND操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将使用ACTION_SEND在Android上发送两个或多个文件作为摘录如下:


意图(android.content.Intent.ACTION_SEND );
emailIntent.setType(plain / text);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
pokus);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,
t);
emailIntent.putExtra(android.content.Intent.EXTRA_STREAM,



emailIntent.putExtra(android.content.Intent.EXTRA_STREAM,
Uri.parse(file:///sdcard/file1.jpg));



emailIntent.putExtra(** android.content .Intent.EXTRA_STREAM,
Uri.parse(file:///sdcard/file2.jpg));



startActivity(Intent .createChooser(emailIntent,
发送邮件...));


但是该代码不能与Gmail请帮助
谢谢

解决方案

我相信使用GMail是不可能的。 >

如果要手动编程发送电子邮件(跳过GMail客户端),则可以使用android-javamailer附加尽可能多的项目:



http://www.jondev.net/articles/Sending_Emails_without_User_Intervention_%28no_Intents%29_in_Android


I would send two or more files using ACTION_SEND on Android as an excerpt below:

Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("plain/text"); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "pokus"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "t" ); emailIntent.putExtra(android.content.Intent.EXTRA_STREAM,

emailIntent.putExtra(android.content.Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/file1.jpg"));

emailIntent.putExtra(**android.content.Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/file2.jpg"));

startActivity(Intent.createChooser(emailIntent, "Send mail..."));

But that code does not work with GMail, it attaches only the last file. Please help Thanks

解决方案

I believe it's impossible using GMail.

If you want to programmaticly send email manually (skipping the GMail client), then you could attach as many items as you want, using android-javamailer:

http://www.jondev.net/articles/Sending_Emails_without_User_Intervention_%28no_Intents%29_in_Android

这篇关于如何在Android上附加两个或多个文件到SEND操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆