Android - Facebook分享按钮无法点击

时间:2015-09-20 23:16:44

标签: android facebook facebook-android-sdk facebook-sharer facebook-share

我正在尝试实现FaceBook提供的“共享”功能,以便从我的Android应用的当前屏幕发布一条简单的消息。我可以在活动启动时触发show ShareDialog但是当单击ShareButton时我无法复制此内容,而是单击按钮后面的内容。

在Facebook文档中,没有使用OnClickListener:

ShareLinkContent content = new ShareLinkContent.Builder()
    .setContentUrl(Uri.parse("https://developers.facebook.com"))
    .build();
shareDialog.show(content);

按下按钮

ShareButton shareButton = (ShareButton)findViewById(R.id.fb_share_button);
shareButton.setShareContent(content);

根据我的理解,这意味着有一个内置的监听器,可以在setShareContent点击时触发shareButton

这是我的MainActivity

public class MainActivity extends MainActivitySettings {

CallbackManager callbackManager;
ShareDialog shareDialog;

@Override
protected void onCreate(Bundle savedInstaceState){
super.onCreate(savedInstanceState);

FacebookSdk.sdkInitialize(getApplicationContext());
        callbackManager = CallbackManager.Factory.create();
        shareDialog = new ShareDialog(this);

        setContentView(R.layout.activity_main);


        ShareLinkContent content = new ShareLinkContent.Builder()
                 .setContentTitle("Title Description")
                 .setContentDescription("Some Content Description")
                 .build();



        ShareButton shareButton = (ShareButton)findViewById(R.id.fb_share);
        shareButton.setShareContent(content);
        shareDialog.show(content);
}
}

非常感谢任何帮助,

干杯

0 个答案:

没有答案