I have tried to read this, but I think I cant find the solution.
say I have FragmentA and Fragment B. I move to fragment B using this code
val nextDestination = AFragmentDirections.actionToB()
findNavController().navigate(nextDestination)
when I back from fragment B to fragment A, onDestroy in my fragment is called and then onCleared on my ViewModel is also get called.
but when I rotate the phone (configuration changes), when onDestroy is called, then onCleared is NOT called.
so I previously assume, when onDestroy called, then onCleared is also called. but it is not. why there is different behaviour like this ? when configuration changes is different from fragment navigation ?
I am confused when exactly the onCleared is called