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

我正在尝试使用附加的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); 

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