【发布时间】:2011-10-19 13:19:32
【问题描述】:
我在与 Gmail 应用程序共享图像时遇到问题。 这是我的代码。
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getString(R.string.mail_subject));
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, getString(R.string.mail_body));
emailIntent.putExtra(Intent.EXTRA_TITLE, getString(R.string.facebook_share_text));
//Download the image first
String location=downloadImage(true);
File root=android.os.Environment.getExternalStorageDirectory();
Log.e("send from where:","file:///"+root.getAbsolutePath()+"/"+location);
//Add attachment
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///"+root.getAbsolutePath()+"/"+location));
emailIntent.setType("image/jpeg");
startActivity(Intent.createChooser(emailIntent, getString(R.string.share_by)));
默认电子邮件应用程序运行良好,Facebook Share 运行良好,Gmail 应用程序正常运行,但附件未发送,尽管显示为附件。
这里是屏幕截图。
所以请帮忙。
【问题讨论】: