onActivityResult is not being called in Fragment

后端 未结 30 2637
忘了有多久
忘了有多久 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 04:57

    I'm having this same problem with the ChildFragmentManager. The manager will not pass the result to the nested fragment, you have to do that manually in your base fragment.

    public void onActivityResult(int requestCode, int resultCode, Intent intent) {
        super.onActivityResult(requestCode, resultCode, intent);
        Fragment fragment = (Fragment) getChildFragmentManager().findFragmentByTag(childTag);
        if (fragment != null) {
            fragment.onActivityResult(requestCode, resultCode, intent);
        }
    }
    

提交回复
热议问题