In my Android application, when I rotate the device (slide out the keyboard) then my Activity
is restarted (onCreate
is called). Now, this is proba
One of the best component of android architechure introduce by google will fulfill your all the requirement that is ViewModel.
That is designed to store and manage UI related data in lifecycle way plus that will allow data to survive as screen rotates
class MyViewModel : ViewModel() {
Please refer this:https://developer.android.com/topic/libraries/architecture/viewmodel