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.
Why ViewModel onCleared() is called when user navigates to another fragment but it doesn't called after device rotation?
193 views Asked by I.S At
0