问题分享在Twitter分享意图合并文本和图像 [英] Problems sharing combined text and image with SHARE INTENT on Twitter

查看:143
本文介绍了问题分享在Twitter分享意图合并文本和图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想给用户一个共享图像和Twitter和Facebook上的文本的可能性。

其实我的code能推出Android的市场份额意图,如果用户选择的Facebook,一切工作正常,图像连接和文本显示上的新地位的机构。

但有些事情是错的微博,如果我只是把一个图像的所有工作正常,图像是由Twitter的检测,并自动上传到twipic,那么Twitter的职位图像上鸣叫的链接。但是,如果我把图像和文字,然后,微博不检测的图像,它只是把文字的鸣叫,图像将被忽略。什么是错的?

这是我的code:

 意图sharingIntent =新的意图(Intent.ACTION_SEND);
乌里screenshotUri = Uri.parse(文件:///sdcard/image.jpg);
sharingIntent.setType(图像/ *);
sharingIntent.putExtra(Intent.EXTRA_TEXT的新地位正文文本);
sharingIntent.putExtra(Intent.EXTRA_STREAM,screenshotUri);
startActivity(Intent.createChooser(sharingIntent,分享图像使用));
 

解决方案

指定MIME类型也为文本。 text / plain的是文本数据的MIME类型。尝试使用* / *为MIME,这样你就可以发送任何通用的数据类型。

也可以尝试改变 ACTION_SEND ACTION_SEND_MULTIPLE 它专门用于传送多个数据。

有关ACTION_SEND_MULTPLE和处理MIME类型的更多信息:

<一个href="http://developer.android.com/reference/android/content/Intent.html">http://developer.android.com/reference/android/content/Intent.html

I want to give the user the possibility to share a Image and a Text with Twitter and Facebook.

Actually my code can launch Android's share intent and if the user selects Facebook, all works fine, the Image is attached and the text is shown on the body of the new status.

But something is wrong with Twitter, if i only put a Image all works fine, the image is detected by twitter and automatically uploaded to twipic, then twitter posts the link of the image on the tweet. But if i put a image and a text, then, twitter doesn't detect the image and it only puts the text on the tweet, the image is ignored. What is wrong?

this is my code:

Intent sharingIntent = new Intent(Intent.ACTION_SEND);
Uri screenshotUri = Uri.parse("file:///sdcard/image.jpg");
sharingIntent.setType("image/*");
sharingIntent.putExtra(Intent.EXTRA_TEXT, "Body text of the new status");
sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
startActivity(Intent.createChooser(sharingIntent, "Share image using"));

解决方案

Specify MIME type also for the text. "text/plain" is the type of text data MIME. Try using "*/*" as MIME, so you can send any generic data type.

Also try changing ACTION_SEND to ACTION_SEND_MULTIPLE which specialized for delivering multiple data.

More info about ACTION_SEND_MULTPLE and handling MIME types:

http://developer.android.com/reference/android/content/Intent.html

这篇关于问题分享在Twitter分享意图合并文本和图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆