【问题标题】:How to launch email intent with an attached image?如何使用附加图像启动电子邮件意图?
【发布时间】:2009-06-29 20:02:35
【问题描述】:

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

【问题讨论】:

    标签: java android


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-03-06
      • 2017-04-11
      • 1970-01-01
      • 1970-01-01
      • 2010-10-06
      • 2016-12-29
      • 2013-12-01
      相关资源
      最近更新 更多