I have read different post where it is mentioned that onCleared() of ViewModel is called in between onDestroyView and onDetach. So when I leave Fragment and navigate to another Fragment onDestroyView is called ,then onCleared() followed by onDestroy(). when I do screen rotation onDestroyView is called and then onDestroy() . During rotation onCleared() isn't called. Wondering how it understands when onCleared() method should be called. I was expecting after I leave fragment and return to Fragment the viewModel still should be alive.

0

There are 0 answers