Gabor Varadi
1 min readFeb 15, 2019

--

If you use Simple-Stack then the StateChanger only starts executing before onPause. The backstack operation is enqueued until a StateChanger is set again (in onResume). However, even with this setup, it is possible to crash fragments just by spamming HOME + a navigation button; because FragmentTransaction runs on the next event loop, and by that time the app could be in the background. For this case, I combine the enqueue behavior with commitAllowingStateLoss() — as that is safer to use than commitNow() because commitNow can affect animations in strange ways for some reason.

--

--

Gabor Varadi
Gabor Varadi

Written by Gabor Varadi

Android dev. Zhuinden, or EpicPandaForce @ SO. Extension function fan #Kotlin, dislikes multiple Activities/Fragment backstack.

No responses yet