如何使用附加图像启动电子邮件意图?

4

我正在尝试使用附加的jpg启动电子邮件意图。

我已经:

Intent intent4 = new Intent(Intent.ACTION_SENDTO,
Uri.fromParts("mailto", "testemail@gmail.com", null));
startActivity(intent4);

这将启动电子邮件活动。

但是当我尝试添加DataAndType(我的jpeg附件)时,它失败了,显示以下错误信息:

android.content.ActivityNotFoundException: No Activity found to handle Intent { action=android.intent.action.SENDTO data=file:///data/data/com.mycompany.mypackage/files/temp-picture type=JPEG 


Intent intent4 = new Intent(Intent.ACTION_SENDTO,
  Uri.fromParts("mailto", "testemail@gmail.com", null));
intent4.setDataAndType(Uri.parse("file://"+ mTempFilePath),
  Bitmap.CompressFormat.JPEG.name());    
startActivity(intent4);
1个回答

2

你是否尝试手动将mime设置为"image/jpeg",而不是使用Bitmap.CompressFormat.JPEG.name()?


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接