When the user changes the system theme from the notification menu, my activity getting recreated and data is loaded again, which is not my app's requirement.
Is it possible to prevent a system theme change from affecting my application in this way?
Don't stop the theme change instead store your data in viewModels.
The ViewModel class is designed to store and manage UI-related data in a lifecycle conscious way. The ViewModel class allows data to survive configuration changes such as screen rotations or theme change.
Have a look : viewModel
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With