Refresh fragment is not working any more?

前端 未结 4 1032
失恋的感觉
失恋的感觉 2021-01-05 07:23

I lost some hours today because my code was not working any more. The code to reload the view of a fragment was not working anymore after updating to the new version of Supp

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-05 07:52

    Faced a similar issue after updating androidx.navigation from 2.3.1 to 2.3.2.

    parentFragmentManager.beginTransaction().detach(this).attach(this).commit()
    

    has stopped reload the view of a fragment. Everything that I found here did not help, but I noticed that separately the detach and attach operations are being performed successfully, I decided to spread their execution to different FragmentTransaction entities:

    parentFragmentManager.beginTransaction().detach(this).commit ()
    parentFragmentManager.beginTransaction().attach(this).commit ()
    

    and it worked. Hope this saves someone some time.

提交回复
热议问题