2009-06-29 76 views
3

我想用附加的jpg发起一个电子邮件意向。如何使用附加图像启动电子邮件意向?

我所做的:

Intent intent4 = new Intent(Intent.ACTION_SENDTO, 
Uri.fromParts("mailto", "[email protected]", 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", "[email protected]", null)); 
intent4.setDataAndType(Uri.parse("file://"+ mTempFilePath), 
    Bitmap.CompressFormat.JPEG.name());  
startActivity(intent4); 

回答

1

你尝试手动设置MIME到"image/jpeg"而不是Bitmap.CompressFormat.JPEG.name()

相关问题