2009-06-29 53 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()

相關問題