【问题标题】:Android: Sharing "EXTRA_TEXT" caption with ImageAndroid:与图像共享“EXTRA_TEXT”标题
【发布时间】:2015-01-19 18:17:33
【问题描述】:

我已经使用 Intents 实现了共享功能,并且它工作正常。我通过将其转换为文件来共享位图。但是当用户分享它时,我想在帖子中添加一个额外的标题。我试过这个:

Intent share = new Intent(android.content.Intent.ACTION_SEND);
share.setType("image/*");
share.putExtra(Intent.EXTRA_TEXT, " Shared via App"); //this part doesnt work
share.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + sharefile));
//sharefile is my image file. It gets shared properly. 
try {
    startActivity(Intent.createChooser(share, "Share Product"));
} catch (Exception e) {                         


} 

但它不共享 CAPTION。它成功共享图像。

【问题讨论】:

  • 您将图像和标题分享给哪个应用程序?
  • Facebook,instagram,多个 :) 有一个选择器,所以用户决定 @Tanis.7x

标签: java android android-intent mobile android-sharing


【解决方案1】:

尝试 Intent.ACTION_SEND_MULTIPLE 代替 Intent.ACTION_SEND

【讨论】:

    【解决方案2】:

    其他应用程序确定它们是否支持将标题附加到图像。如果您在忽略随图像传递的Intent.EXTRA_TEXT 的特定平台遇到问题,则需要联系该应用程序的开发人员以获得支持。

    Facebook 是不支持将标题或描述附加到图像的平台示例之一。 Here's a bug report 请求此功能并得到 Facebook 团队的回复。在这种情况下,附加消息将违反 Facebook 的平台政策。

    【讨论】:

      【解决方案3】:

      只需添加这一行:

        intent.putExtra(Intent.EXTRA_TEXT, caption);
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2023-04-03
        • 2019-01-09
        • 1970-01-01
        • 2014-06-20
        • 2014-09-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多