Facebook SDK 使用 ShareDialog 报错
Error in Using ShareDialog for Facebook SDK
我已经导入了Facebook SDK into Eclipse without errors and I am trying to follow the instructions here to use the ShareDialog。
这是我看到的错误。不确定从哪里导入 class Result
?如您所见,其他 Facebook SDK 类 已正常导入。
代码如下:
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
}
});
您应该导入:
import com.facebook.share.Sharer;
并更改您的:
@Override
public void onSuccess(Result result){
为了
@Override
public void onSuccess(Sharer.Result result) {
// TODO Auto-generated method stub
}
这对我有用
我已经导入了Facebook SDK into Eclipse without errors and I am trying to follow the instructions here to use the ShareDialog。
这是我看到的错误。不确定从哪里导入 class Result
?如您所见,其他 Facebook SDK 类 已正常导入。
代码如下:
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
}
});
您应该导入:
import com.facebook.share.Sharer;
并更改您的:
@Override
public void onSuccess(Result result){
为了
@Override
public void onSuccess(Sharer.Result result) {
// TODO Auto-generated method stub
}
这对我有用