AndrodManifest.xml
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProviderMYFACEBOOKID"
android:exported="true" />
MainActivity.java
FacebookSdk.sdkInitialize(getApplicationContext());
Bitmap image = BitmapFactory.decodeResource(getResources(), R.drawable.fb_image);
SharePhoto photo = new SharePhoto.Builder()
.setBitmap(image)
.setCaption("#Tutorialwing")
.build();
SharePhotoContent content = new SharePhotoContent.Builder()
.addPhoto(photo)
.build();
ShareButton shareButton = (ShareButton) findViewById(R.id.fb_share_button);
shareButton.setShareContent(content);
当我单击共享按钮时,没有任何反应。我完全看不到预览。
但是当我使用以下代码共享链接时,它会起作用。
ShareLinkContent content = new ShareLinkContent.Builder()
.setContentUrl(Uri.parse("https://developers.facebook.com"))
.setImageUrl(Uri.parse("https://www.numetriclabz.com/wp-content/uploads/2015/11/114.png"))
.build();
ShareButton shareButton = (ShareButton) findViewById(R.id.fb_share_button);
shareButton.setShareContent(content);
你们知道为什么我不能分享图片吗?