使用ShareDialog for Facebook SDK时出错

时间:2023-01-22 17:37:37

I have imported Facebook SDK into Eclipse without errors and I am trying to follow the instructions here to use the ShareDialog.

我已经将Eclipse SDK导入Eclipse而没有错误,我试图按照这里的说明使用ShareDialog。

Here is the error I see. Not sure where to import the class Result from? As you can see the other Facebook SDK Classes have imported fine.

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

使用ShareDialog for Facebook SDK时出错

Here's the code:

这是代码:

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 个解决方案

#1


You should import:

你应该导入:

 import com.facebook.share.Sharer;

and change your:

并改变你的:

      @Override
         public void onSuccess(Result result){

for

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

        }

This worked for me

这对我有用

#1


You should import:

你应该导入:

 import com.facebook.share.Sharer;

and change your:

并改变你的:

      @Override
         public void onSuccess(Result result){

for

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

        }

This worked for me

这对我有用