Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/180.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
Android 将图像作为附件从资源发送_Android_Email Attachments_Android Assets - Fatal编程技术网

Android 将图像作为附件从资源发送

Android 将图像作为附件从资源发送,android,email-attachments,android-assets,Android,Email Attachments,Android Assets,这是我的代码,它确实发送邮件,但没有任何图像作为附件 EditText eto=(EditText)findViewById(R.id.etxtTo); EditText esub=(EditText)findViewById(R.id.etxtSubject); String to=eto.getText().toString(); String sub=esub.getText().toString(); Intent emailIntent = new Intent(andr

这是我的代码,它确实发送邮件,但没有任何图像作为附件

 EditText eto=(EditText)findViewById(R.id.etxtTo);
 EditText esub=(EditText)findViewById(R.id.etxtSubject);

 String to=eto.getText().toString();
 String sub=esub.getText().toString();

 Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
 emailIntent.setType("application/image");
 //emailIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
 //String filePath = ImageDetailActivity.this.getResources().getAssets()+"/"+file;
 //Log.d("file address",filePath);
 //Log.d("file address method2","file:///android_assets/"+file);
 File ff=new File(filePath);
 pngUri=Uri.fromFile(new File("file:///android_assets/"+file));
 emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{to});
 emailIntent.putExtra(Intent.EXTRA_SUBJECT, sub);

 emailIntent.putExtra(android.content.Intent.EXTRA_STREAM,Uri.parse("file:///android_assets/"+file));
 startActivity(Intent.createChooser(emailIntent, "Choose an Email client :"));
这里的问题是我无法接收邮件附带的图像。
我尝试了很多方法来寻找解决方案,但无法解决问题,你的问题是?我收到了邮件,但没有图片作为附件。谢谢你收到的是没有附件的邮件还是有“空”附件的邮件?我收到的是没有附件的邮件。