Gabor Varadi
Apr 4, 2021

--

Navigation frameworks SHOULD, and in fact, MUST correctly handle process death, if they intend to be deemed production ready. The outlined approach uses a global singleton, which does not.

Making objects passed from one component to another parcelable serves a very specific purpose: namely to obey the Android OS-level Activity contract of correctly restoring navigation state across process death.

http://web.archive.org/web/20180505121013/https://plus.google.com/+DianneHackborn/posts/FXCCYxepsDU

I do admit that Navigation-Compose being incapable of passing even Parcelable objects is massive limitation, having to serialize everything to a String is super weird: but I already solved this problem in such a way that does NOT break either process death restoration nor Compose Saveable.

https://medium.com/nerd-for-tech/simplified-navigation-between-composables-of-jetpack-compose-using-simple-stack-9a796a909128

Any navigation solution that intends to be a replacement for the current recommendation should also handle the general cases that Activity/Fragment-based navigation have already handled previously.

--

--

Gabor Varadi
Gabor Varadi

Written by Gabor Varadi

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

Responses (1)