使用ShareDialog for Facebook SDK时遇到错误

时间:2015-05-07 17:38:06

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

我已将Facebook SDK导入Eclipse而没有错误,我正在尝试关注instructions here to use the ShareDialog

这是我看到的错误。不知道从哪里导入类Result?如您所见,其他Facebook SDK类已导入正常。

enter image description here

以下是代码:

FacebookSdk.sdkInitialize(getApplicationContext());
    callbackManager = CallbackManager.Factory.create();
    shareDialog = new ShareDialog(this);
    // this part is optional
    shareDialog.registerCallback(callbackManager, new FacebookCallback<Sharer.Result>() {

        @Override
        public void onSuccess(Result result) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onCancel() {
            // TODO Auto-generated method stub

        }

        @Override
        public void onError(FacebookException error) {
            // TODO Auto-generated method stub

        }

        });

1 个答案:

答案 0 :(得分:0)

您应该导入:

 import com.facebook.share.Sharer;

并改变你的:

      @Override
         public void onSuccess(Result result){

      @Override
        public void onSuccess(Sharer.Result result) {
            // TODO Auto-generated method stub

        }

这对我有用