繁体   English   中英

HTC Thunderbolt上的Android Email Multiple Attachment问题

[英]Android Email Multiple Attachment issue on HTC Thunderbolt

我这里有一个奇怪的情况。

我正在尝试使用以下代码发送带有多个附件的电子邮件。

Intent emailIntent = new Intent( android.content.Intent.ACTION_SEND_MULTIPLE );
// emailIntent.setType( "plain/text" );
emailIntent.setType( "application/octet-stream" );
...
....
emailIntent.putParcelableArrayListExtra( Intent.EXTRA_STREAM, uris );

这很好用,隐式意图机制显示了很多选项,如Gmail,Skype,Messaging等。

问题是默认的Mail客户端没有显示在HTC Thunderbolt上 (但适用于其他设备,包括HTC Incredible S)。

如果我尝试使用Intent.ACTION_SEND发送单个附件, Intent.ACTION_SEND显示默认邮件客户端 我已经尝试将内容类型设置为text / plain,appliation / octet-stream,message / rfc282等但是没有效果。

我在这里错过了什么?

我有同样的问题,我修复了使用http Mime库的多部分表单实体。

这是文件的链接。 http://hc.apache.org/httpcomponents-client-4.3.x/httpmime/apidocs/org/apache/http/entity/mime/HttpMultipart.html

听起来像Thunderbolt的Sense版本中的一个错误。 获胜的自定义用户界面,对吗?

无论如何,我会查看应用程序实际上在雷电上处理电子邮件,并使用if语句来检测设备是否是一个霹雳。 如果是,则将Intent的目标类设置为任何目标类。 如果不是,那就做你正在做的事。

这对我很有用,一定要指定消息类型,这就是android os知道要使用哪个广播的方式。

     String email = "test@email.com";
    Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
    intent.setType("message/rfc822");
    intent.putExtra(Intent.EXTRA_EMAIL, new String[] {email}); // could have multiple address
    intent.putExtra(Intent.EXTRA_SUBJECT, "Enter your subject here");
    intent.putExtra(Intent.EXTRA_TEXT, "message text as needed");
    ArrayList<Uri> arrayUri = new ArrayList<Uri>();
    arrayUri.add(Uri.parse("file://" + paths[0]));
    arrayUri.add(Uri.parse("file://" + paths[1]));
    intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, arrayUri);
    startActivity(Intent.createChooser(intent, "Any title to show on chooser"));

尝试这个。 我认为它会起作用。

final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
emailIntent.setType("plain/text");

ArrayList<Uri> uris = new ArrayList<Uri>();

String[] filePaths = new String[] {image1 Path,image2 path};
for (String file : filePaths) {
    File fileIn = new File(file);
    Uri u = Uri.fromFile(fileIn);
    uris.add(u);
}

if ( !(app_preferences.getString("email", "") == null || app_preferences.getString("email", "").equals(""))) {
    emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] {app_preferences.getString("email", "")});    
}

emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject name");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Please find the attachment.");
emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);

startActivity(Intent.createChooser(emailIntent, "Email:"));

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM