安卓分享文字和放大器;图像(URL)通过意向 [英] Android: Share Text & Image (URL) Via Intent
问题描述
我想通过一个ACTION_SEND意向共享文本与图像。美中不足的是,该图像是由一个URL,而不是本地URI psented重新$ P $。在code我现在拥有的是:
I am trying to share text with an image via an ACTION_SEND intent. The catch is that the image is represented by a URL, not a local URI. The code I currently have is:
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("*/*");
shareIntent.putExtra(Intent.EXTRA_TEXT, text); // <- String
shareIntent.putExtra(Intent.EXTRA_STREAM, url); // <- URL object
现在我已经尝试过这样的一些变化。我试过用的setType(图像/ *),我试着从URL解析一个开放的,我已经试过传递URL字符串本身,等没事到目前为止似乎工作。然而,发送时叽叽喳喳我看到的文字,只是没有图像。
Now I've tried a few variations on this. I've tried with setType("image/*"), I've tried parsing a Uri from the URL, I've tried passing the URL string itself, etc. Nothing so far seems to work. However, when sending to twitter I do see the text, just not the image.
编辑: 显然,原来的描述是不够的帮助,所以....当我启动上述意图它成功地打开了一个选择的应用如Twitter或Facebook或Gmail或短信,但在这些应用程序无图像appars。该文本显示在Twitter的 - 如果文字出现在其他地方,但我的重点在这一刻是在图像部分反正我不记得
Apparently the original description was not helpful enough, so....when I launch the above intent it successfully opens a chosen application like Twitter, or Facebook, or Gmail, or Text Messaging, but an image appars in NONE of these apps. The text appears in Twitter - I can't remember if the text appears elsewhere, but my focus at this moment is on the image part anyway.
推荐答案
您将无法以这种方式,因为Facebook的政策,在Facebook上分享,因为它说的的known错误:
You won't be able to share on Facebook in that way because of Facebook's policy as it says in a known bug:
API不支持pre填充用户信息
API does not support pre-filling the message for users
这篇关于安卓分享文字和放大器;图像(URL)通过意向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!