我想通过意图从特定的URL分享照片到Facebook。

http://tineye.com/images/widgets/mona.jpg

Intent sharingIntent = new Intent(Intent.ACTION_SEND);
Uri screenshotUri = Uri.parse("http://tineye.com/images/widgets/mona.jpg");
sharingIntent.setType("image/png");
sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
startActivity(Intent.createChooser(sharingIntent, "Share image using"));


从画廊它的罚款。

但是,当我通过url到意图照片上方时,无法在Facebook上分享。

帮帮我......

最佳答案

要从Web网址发布图像,请执行以下步骤:

步骤1:从URL获取位图:

看到这篇文章

How to load an ImageView by URL in Android?

用于从URL获取图像位图

第2步 :

将位图临时存储在Images.Media中,发送后可以将其删除

String path = Images.Media.insertImage(getContentResolver(),
                            bitmapiamge, "title", null);
Uri screenshotUri = Uri.parse(path);

Intent sharingIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
emailIntent.setType("image/png");

startActivity(Intent.createChooser(emailIntent, "Send email using"));


并将位图发送到Facebook墙,请参阅以下文章:

Android: Intent.ACTION_SEND with EXTRA_STREAM doesn't attach any image when choosing Gmail app on htc Hero

07-28 01:49
查看更多