8

新しい SDK で Facebook の新しい SharePhoto & SharePhotoContent クラスを使用して写真を共有しようとしています。ローカルに保存された画像ではなく、画像の URL を使用したいと考えています。

ローカルに保存されたドローアブル リソースを使用して画像を共有できます。

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 shareDialog の空白の投稿だけです。

他の誰かがこれを試して動作させましたか?

どうもありがとう!

4

3 に答える 3

1

ローカル画像の代わりにリンクを使用している場合は、ドキュメントから SharePhoto の代わりに ShareDialog を使用する必要があります

ShareLinkContent linkContent = new ShareLinkContent.Builder()
        .setContentTitle("title")
        .setContentDescription("description")
        .setContentUrl(Uri.parse("your link"))
        .build();
于 2015-04-03T05:37:11.383 に答える
1

画像のURLを共有したい場合は、次を使用する必要がありsharelinkcontentます。

    ShareLinkContent linkContent = new ShareLinkContent.Builder()
            .setContentTitle("Shared from nearbyme application")
            .setContentDescription("This is a wonderful place")
            .setContentUrl(Uri.parse("http://www.villathena.com/images/nearby/thumbs/le-bus-bleu-private-tours.jpg"))
            .setImageUrl(Uri.parse("http://www.villathena.com/images/nearby/thumbs/le-bus-bleu-private-tours.jpg"))
            .build();
      shareDialog.show(content);
于 2015-04-18T15:18:45.940 に答える