我将使用 Facebook 的新 SharePhoto 和 SharePhotoContent 类在新的 SDK 中翻译并分享一张图片。我想使用图片的 URL 而不是本地存储的图片。
我可以使用本地存储的 drawable 资源来分享一张图片:
但是当我尝试使用图片URL时:
我可以使用本地存储的 drawable 资源来分享一张图片:
Bitmap image = BitmapFactory.decodeResource(getResources(), R.drawable.carrots);
SharePhoto photo = new SharePhoto.Builder()
.setImageBitmap(image)
.build();
SharePhotoContent content = new SharePhotoContent.Builder()
.addPhoto(photo)
.build();
shareDialog.show(content);
但是当我尝试使用图片URL时:
SharePhoto photo = new SharePhoto.Builder()
.setImageUrl(Uri.parse("http://s3-ak.buzzfed.com/static/images/public/verticals/food-title.png?v=201504021353"))
.build();
我在Facebook分享对话框中只看到一个空白帖子。
有人尝试过并成功了吗?
非常感谢!
SharePhoto
分享由contentProvider
提供的图片,例如使用content://
URI的图片? - Shubham Naik