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
Activity
onCreate
You may use ViewModel object in your activity.
ViewModel objects are automatically retained during configuration changes so that data they hold is immediately available to the next activity or fragment instance. Read more:
https://developer.android.com/topic/libraries/architecture/viewmodel