cocos2d-x Facebook集成(由于焦点视图无法保存哪个视图具有焦点)

时间:2013-05-13 13:14:28

标签: java facebook cocos2d-x

我只是想在我的应用中使用Facebook登录。 并且我的应用程序因此错误而崩溃“无法保存哪个视图具有焦点,因为焦点视图org.cocos2dx.lib.Cocos2dxGLSurfaceView@405ed960没有id” 这是我的Facebook集成代码:

public class wtpbgamazon extends Cocos2dxActivity{
    private Cocos2dxGLSurfaceView mGLView;
    private static Chartboost cb;


    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        PurchasingManager.registerObserver(new amazonobserver());

        // start Facebook Login



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

            @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) {
                           //todo
                          }
                        }
                      });
                    }

            }
        });
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        Log.v("onActivityResult Was Called", "good");
      super.onActivityResult(requestCode, resultCode, data);
      Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
    }

有人可以帮我这个吗?感谢

1 个答案:

答案 0 :(得分:0)

我最近在游戏中集成了FB。我打开了另一个活动,而不是在主要活动中处理FB代码。