Android \ Intent:发送带有图片附件的电子邮件

电子邮件正在收件人收到,但没有附件。 这里是代码,任何专家知道我哪里错了?

Intent messageIntent = new Intent(android.content.Intent.ACTION_SEND); String aEmailList[] = { "mymailgmail.com" }; messageIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList); messageIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject); ... messageIntent.setType("image/jpeg"); File downloadedPic = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), "MyApp.jpg"); messageIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(downloadedPic)); startActivity(Intent.createChooser(messageIntent, getResources().getString(R.string.chooser_pic))); 

我得到:

file://附件path必须指向file:// sdcard。 忽略附件文件://…file名称是MyApp.jpg

我没有得到形象,只有文字信息。 谢谢。

尝试下面的代码…

 Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("application/image"); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{strEmail}); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Test Subject"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "From My App"); emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///mnt/sdcard/Myimage.jpeg")); startActivity(Intent.createChooser(emailIntent, "Send mail...")); 
 Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, emailaddress); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, message); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject); emailIntent.setType("application/image"); Uri uri = Uri.parse("file://" + filepath); emailIntent.putExtra(Intent.EXTRA_STREAM, uri); startActivity(emailIntent);