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

前端 未结 8 1637
广开言路
广开言路 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:08

    For me probably it was a newbie mistake that I was calling super.onCreate(savedInstanceState); after I was trying to access the Fragment using findFragmentByTag.

    I moved super.onCreate(savedInstanceState) up in the order and it started working for me.

提交回复
热议问题