Android Fragment UI not updated after popBackStack()
Have you ever experience your fragment’s UI not updating after exit from another fragment?
I spent hours to find out that the reason of this weirdness is that the fragment state after supportFragmentManager.popBackStack() is causing this issue
So, the solution is to use
instead, where the “theFragment” is the fragment name used when you add the fragment to back stack:
val transaction = supportFragmentManager.beginTransaction()
Using supportFragmentManager.popBackStackImmediate(“theFragment”, 0) can make sure your fragment is in the correct state for updating the UI elements.
Let me know if you find better solution or approach in the comment section below. ;)
Find me at Twitter @rick3817
Problems with Android Fragment back stack
I've got a massive problem with the way the android fragment backstack seems to work and would be most grateful for any…
#android #androiddev #androidfragment #fragment #backstack