Android Facebook状态回拨无法使用碎片

Android Facebook状态回拨无法使用碎片,android,facebook-sdk-3.0,Android,Facebook Sdk 3.0,我试图在它成功登录的片段中使用SFB登录回调,fb显示应用程序已授权,但回调不起作用。 当我在活动中尝试相同的代码时,它是有效的。在碎片的情况下我是否遗漏了什么 public void faceBook(View view) { if (FacebookDialog.canPresentShareDialog(getApplicationContext(), FacebookDialog.ShareDialogFeature.SHARE_DIALOG)) {

我试图在它成功登录的片段中使用SFB登录回调,fb显示应用程序已授权,但回调不起作用。 当我在活动中尝试相同的代码时,它是有效的。在碎片的情况下我是否遗漏了什么

public void faceBook(View view) {
    if (FacebookDialog.canPresentShareDialog(getApplicationContext(),
            FacebookDialog.ShareDialogFeature.SHARE_DIALOG)) {
        // Publish the post using the Share Dialog - This is working.
        //When FB not installed else part will execute - There I have issue
    } else {
        Session session = Session.getActiveSession();
        if(!session.getState().isOpened()) {
//here am setting the status call back as third parameter "this" and implemented Session.status call back in my class which is extended a fragment
//so publishFeedDialog did not get called after login
            Session.openActiveSession(this, true, this); 
        } else {
            publishFeedDialog(session);
        }
    }
}

@Override
public void call(Session session, SessionState sessionState, Exception e) {
      //A call supposed to come here after user sign to fb, but that is not happening. (fb shows app as authorized) but callback doesn't work. When I am trying same code with Activity it works
    if(session.getState().isOpened()) {
        publishFeedDialog(session);
    }
}

我查看了FacebookSession类,发现Session.openActiveSession的另一个版本可以从片段中使用

openActiveSession(context, fragment, allowLoginUI, statusCallback);

确保片段是android.support.v4.app.fragment

或者添加一些代码,然后我们将能够确定您是否缺少某些内容