Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/218.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
HTC Thunderbolt上的Android电子邮件多附件问题_Android_Android Intent_Email Attachments_Htc Thunderbolt - Fatal编程技术网

HTC Thunderbolt上的Android电子邮件多附件问题

HTC Thunderbolt上的Android电子邮件多附件问题,android,android-intent,email-attachments,htc-thunderbolt,Android,Android Intent,Email Attachments,Htc Thunderbolt,我这里的情况很奇怪 我正在尝试使用以下代码发送带有多个附件的电子邮件 Intent emailIntent = new Intent( android.content.Intent.ACTION_SEND_MULTIPLE ); // emailIntent.setType( "plain/text" ); emailIntent.setType( "application/octet-stream" ); ... .... emailIntent.putParcelableArrayListE

我这里的情况很奇怪

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

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、消息等

问题是默认邮件客户端不会出现在HTC Thunderbolt上(但可以在包括HTC S在内的其他设备上工作)

如果我尝试使用
Intent.ACTION\u send
发送单个附件,则会显示默认邮件客户端。我曾尝试将内容类型设置为text/plain、appliation/octet-stream、message/rfc282等,但都不起作用


我在这里遗漏了什么?

听起来像是霹雳版的感官上的一个bug。为胜利定制UI,对吗


不管怎样,我会查一下什么样的应用程序能够处理thunderbolt上的电子邮件,然后放一个if语句来检测设备是否是thunderbolt。如果是,则将Intent的目标类设置为任意值。如果不是,就做你已经在做的事情。

这对我来说很好,一定要指定消息类型,这就是android操作系统知道使用哪种广播的方式

     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"));
String电子邮件=”test@email.com";
意向意向=新意向(意向.行动\发送\多次);
intent.setType(“message/rfc822”);
intent.putExtra(intent.EXTRA_EMAIL,新字符串[]{EMAIL});//可能有多个地址
intent.puttera(intent.EXTRA_SUBJECT,“在此处输入您的主题”);
intent.putExtra(intent.EXTRA_文本,“根据需要的消息文本”);
ArrayList arrayUri=新的ArrayList();
add(Uri.parse(“文件:/”+路径[0]);
add(Uri.parse(“文件:/”+路径[1]);
intent.putParcelableArrayListExtra(intent.EXTRA_-STREAM,arrayUri);
startActivity(Intent.createChooser(Intent,“要在选择器上显示的任何标题”);

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

这是该文件的链接。
试试这个。我想它会起作用的

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:"));
final Intent emailIntent=新意图(android.content.Intent.ACTION\u SEND\u MULTIPLE);
emailIntent.setType(“纯/文本”);
ArrayList URI=新的ArrayList();
String[]filepath=新字符串[]{image1路径,image2路径};
用于(字符串文件:文件路径){
File fileIn=新文件(File);
uriu=Uri.fromFile(fileIn);
添加(u);
}
if(!(app_preferences.getString(“email”和“”)==null | | app_preferences.getString(“email”和“”).equals(“”)){
emailIntent.putExtra(Intent.EXTRA_EMAIL,新字符串[]{app_preferences.getString(“EMAIL”,“”));
}
emailIntent.puttera(Intent.EXTRA_SUBJECT,“SUBJECT name”);
emailIntent.putExtra(Intent.EXTRA_文本,“请查找附件”);
emailIntent.putParcelableArrayListExtra(Intent.EXTRA\u流,URI);
startActivity(Intent.createChooser(emailIntent,“Email:”);

最后,我将所有附件捆绑到一个zip文件中,并上传该zip文件。您尝试过吗?