android / architecture-components-samples

Samples for Android Architecture Components.
https://d.android.com/arch
Apache License 2.0
23.4k stars 8.29k forks source link

Is it guaranteed that Fragment's View will be destroyed and recreated while navigating? #953

Open michaldrabik opened 3 years ago

michaldrabik commented 3 years ago

An Android Navigation Component question. Thanks for great work on this by the way.

Is it guaranteed that Fragment's view gets destroyed and recreated when navigating away / coming back to Fragment destination? (onViewDestroyed -> OnViewCreated)

I thought it is but recently I stumbled upon cases when these callbacks are not called. Only onPause and onResume. Is it explained somewhere?

Cheers

michaldrabik commented 3 years ago

Just a follow up.

Apparently if you define app:exitAnim in the relevant navigation graph action the view of exited fragment is NOT destroyed and recreated during navigation forward and backwards. No idea if this is intended or not.