无法在Facebook实施中恢复活动

时间:2013-09-23 11:10:27

标签: android

我尝试将facebook登录到我的应用程序...当我第一次尝试运行该应用程序时,它显示错误消息,例如无法恢复活动.. java.lang.nullPointerException..

   Session.openActiveSession(this, true, new Session.StatusCallback() {

        // callback when session changes state
        @Override
        public void call(Session session, SessionState state,
                Exception exception) {
            if (session.isOpened()) {

                // make request to the /me API
                Request.executeMeRequestAsync(session,
                        new Request.GraphUserCallback() {

                            // callback after Graph API response with user
                            // object
                            @Override
                            public void onCompleted(GraphUser user,
                                    Response response) {
                                if (user != null) {

                                    Intent intent = new Intent(FacebookLogin.this,MainActivity.class);
                                    startActivity(intent);

                                }
                            }
                        });
            }
        }
    });
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Session.getActiveSession().onActivityResult(this, requestCode,
            resultCode, data);

}

0 个答案:

没有答案