gpt4 book ai didi

java - 如何启动带有附加图像的电子邮件 Intent ?

转载 作者:太空狗 更新时间:2023-10-29 14:34:54 30 4
gpt4 key购买 nike

我正在尝试启动带有 jpg 附件的电子邮件 Intent 。

我做到了:

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

这将启动电子邮件 Activity 。

但是当我尝试添加 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()

关于java - 如何启动带有附加图像的电子邮件 Intent ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1060203/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com