如何共享照片通过在Facebook的Android份额意图字幕? [英] How to share photo with CAPTION via Android share intent on Facebook?
问题描述
我想与大家分享的标题$ P $通过共享意图对填充从我的应用程序,Facebook上的照片。
I'd like to share a photo with caption pre-filled from my app via a share intent, on facebook.
我知道如何共享照片或如何共享文本,但我怎么分享他们在一起?
I know how to share photo or how to share text, but how do I share them together?
例如code
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)));
如果一组类型图像/ *
然后照片被上传没有字幕prefilled。如果设置为文本/纯
仅标题上传没有照片......
If a set type to image/*
then a photo is uploaded without the caption prefilled. If a set it to text/plain
only the caption is uploaded without the photo.....
我的猜测是,问题是,Android的Facebook应用程序看起来并不为 Intent.EXTRA_TEXT
时,它过滤了 ACTION_SEND
意图与键入图像/ *
的照片上传。 所以这个问题可能是,如果Android的Facebook应用程序,找了该值,如果present,插入它作为图像的标题解决。
My guess is that the issue is that the Android Facebook App doesn't look for Intent.EXTRA_TEXT
when it filters an ACTION_SEND
Intent with type image/*
for photo uploading. So this issue could be resolved if the Android Facebook App looked for that value, and if present, inserted it as the caption of the image.
推荐答案
将此行添加到您现有的codeS:
Add this line to your existing codes:
shareCaptionIntent.putExtra(Intent.EXTRA_TITLE, "my awesome caption in the EXTRA_TITLE field");
有没有中EXTRA_TITLE,EXTRA_SUBJECT和EXTRA_TEXT明确的差异。因此,有没有明确的共享协议。我们总是可以尝试它们。 : - )
There is no clearly defined differences among EXTRA_TITLE, EXTRA_SUBJECT and EXTRA_TEXT. So there is no clear share protocol. We could always try them all. :-)
这篇关于如何共享照片通过在Facebook的Android份额意图字幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!