如何通过Android上的Android分享意图与CAPTION分享照片?

sia*_*mii 12 android facebook

我想通过Facebook上的分享意图与我的应用程序预先填充的标题分享照片.

我知道如何分享照片或如何分享文字,但我如何分享它们?

示例代码

Intent shareCaptionIntent = new Intent(Intent.ACTION_SEND);
    shareCaptionIntent.setType("image/*");

    //set photo
    shareCaptionIntent.setData(examplePhoto);
    shareCaptionIntent.putExtra(Intent.EXTRA_STREAM, examplePhoto);

    //set caption
    shareCaptionIntent.putExtra(Intent.EXTRA_TEXT, "example caption");
    shareCaptionIntent.putExtra(Intent.EXTRA_SUBJECT, "example caption");

    startActivity(Intent.createChooser(shareCaptionIntent,getString(R.string.share)));
Run Code Online (Sandbox Code Playgroud)

如果image/*上传照片的设置类型,则不会预填充字幕.如果设置为text/plain只有标题上传没有照片.....


我的猜测是问题是Android Facebook App Intent.EXTRA_TEXT在过滤ACTION_SEND带有image/*照片上传类型的Intent 时不会查找.因此,如果Android Facebook应用程序查找该值,则可以解决此问题,如果存在,则将其作为图像的标题插入.

通过Android Intent共享标题

Fra*_* Du 10

将此行添加到现有代码中:

shareCaptionIntent.putExtra(Intent.EXTRA_TITLE, "my awesome caption in the EXTRA_TITLE field");
Run Code Online (Sandbox Code Playgroud)

EXTRA_TITLE,EXTRA_SUBJECT和EXTRA_TEXT之间没有明确的差异.所以没有明确的共享协议.我们总是可以尝试所有这些.:-)


Mer*_*lin 8

这个问题似乎是Facebook应用程序的长期"功能".它的意图处理从未处于完全功能状态.

查看http://forum.developers.facebook.net/viewtopic.php?id=93900上的链接

这需要与Facebook的开发人员一起提升.依赖隐藏在客户端API之后而不是修复显而易见的东西正在对他们起作用.

  • 链接坏了 (3认同)