architecture-components-samples icon indicating copy to clipboard operation
architecture-components-samples copied to clipboard

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

Open michaldrabik opened this issue 4 years ago • 1 comments
trafficstars

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 avatar Jan 28 '21 07:01 michaldrabik

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.

michaldrabik avatar Jan 29 '21 14:01 michaldrabik