Try the Compose way  
Jetpack Compose is the recommended UI toolkit for Android. Learn how to enable state preservation and persistent storage in Compose.  
[State preservation and persistent storage →](https://developer.android.com/develop/ui/compose/touch-input/stylus-input/ink-api-state-preservation)  
![](https://developer.android.com/static/images/android-compose-ui-logo.png)

<br />