onActivityResult is not being called in Fragment

后端 未结 30 2626
忘了有多久
忘了有多久 2020-11-21 04:28

The activity hosting this fragment has its onActivityResult called when the camera activity returns.

My fragment starts an activity for a result with th

30条回答
  •  抹茶落季
    2020-11-21 05:15

    If the above problem is faced at Facebook login then you can use the below code in a parent activity of your fragment like:

    Fragment fragment = getFragmentManager().findFragmentById(android.R.id.tabcontent);
    fragment.onActivityResult(requestCode, resultCode, data);
    

    Or:

    Fragment fragment = getFragmentManager().findFragmentById("fragment id here");
    fragment.onActivityResult(requestCode, resultCode, data);
    

    And add the below call in your fragment...

    callbackManager.onActivityResult(requestCode, resultCode, data);
    

提交回复
热议问题