将图像作为资产附件发送

时间:2013-08-30 13:38:37

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

这里的问题是我无法收到邮件附带的图片。 我已经为解决方案尝试了很多方法,但是无法找出问题

0 个答案:

没有答案
相关问题