【发布时间】:2014-08-05 06:56:02
【问题描述】:
你好朋友,我想在 android 中使用共享意图同时共享文本和 sdcard 图像 下面是我在按钮单击时的代码。
Intent share = new Intent(android.content.Intent.ACTION_SEND);
share.setType("text/plain,image/*");
String imagePath = Environment.getExternalStorageDirectory()
+ "/myfolder/1407156604780.png";
File imageFileToShare = new File(imagePath);
Uri uri = Uri.fromFile(imageFileToShare);
share.putExtra(Intent.EXTRA_STREAM, uri);
share.putExtra(Intent.EXTRA_SUBJECT, "Title Of The Post");
share.putExtra(Intent.EXTRA_TEXT, "fdsfdsfdsfds");
startActivity(Intent.createChooser(share, "Share image to..."));
使用上述代码共享对话框已打开,但 facebook 选项未显示给我,但在我的设备 facebook 应用程序中已经存在,所以我可以为文本设置多个 setType 属性以及图片分享到 facebook ?
【问题讨论】:
-
当您在 fab 上分享您在对话框中看到的内容时?
-
试试 share.setType("text/plain");除了那一行之外,我的代码看起来相同并且工作正常。
-
看看这个..stackoverflow.com/questions/8296605/…它会帮助你很多。
-
嗨,我试过了,但是使用意图你不能分享文本默认你只能分享文本的图像你必须在对话框显示后手动输入文本 twitte 是允许的,但 facebook 是不允许的默认文本跨度>
-
@ Born To Win : 当我使用 setType("/") 和 facebook 选项时,它会给我像 " 这样的祝酒词"请仅附上照片或单个视频”
标签: android facebook android-intent