0

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

 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 :"));

这里的问题是我无法接收邮件随附的图像。我已经尝试了很多方法来寻找解决方案,但无法找出问题所在

4

0 回答 0