findFragmentByTag() returns null after perform a FragmentTransaction using replace() method

前端 未结 8 1722
广开言路
广开言路 2020-11-30 04:44

My Android app consists three fragments: A, B and C. They\'re loaded in the two containers defined in the MainActivity layout.

When th

8条回答
  •  忘掉有多难
    2020-11-30 05:10

    if you use setRetainInstance(true) than you can't use findFragmentByTag() in onCreate from the Activity. Do it at onResume

    see the documentation: setRetainInstance

提交回复
热议问题