Dark Mode and Configuration Changes
When the device changes between normal and dark mode, any visible activities immediately will undergo a configuration change, for the uiMode
configuration. Even manual changes to DayNight
(e.g., setDefaultNightMode()
) will recreate your activity, as if it underwent a configuration change.
If your activities already handle configuration changes (e.g., screen rotation), you should be fine. However:
- If you have activities where you skipped supporting configuration changes, you will need to fix that soon
- If you have activities where you are handling configuration changes manually, via
android:configChanges
in the manifest, consider whether you want to handleuiMode
manually as well
Prev Table of Contents Next
This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.