Facebook login in fragment in android

后端 未结 3 882
闹比i
闹比i 2020-12-28 17:54

I\'m trying to login Facebook using custom interface it worked fine in Activity class. same thing i have to do in Fragment too. but Callback is not executing. is it not poss

3条回答
  •  甜味超标
    2020-12-28 18:34

    You just need to add this code in your Activity onActivityResult.

    for (Fragment fragment : getSupportFragmentManager().getFragments()) {
                //System.out.println("@#@");
                fragment.onActivityResult(requestCode, resultCode, data);
            }
    

    Then your fragment onActivityResult will surely gonna work.

       @Override
            public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
    
    
                callbackManager.onActivityResult(requestCode, resultCode, data);
            }
    

提交回复
热议问题