Skip to content

Instantly share code, notes, and snippets.

@nawanirakshit
Created April 5, 2024 09:09
Show Gist options
  • Save nawanirakshit/35de040328ecde657a9f44941d78c6fb to your computer and use it in GitHub Desktop.
Save nawanirakshit/35de040328ecde657a9f44941d78c6fb to your computer and use it in GitHub Desktop.
Android: Change app theme
We can select any othe of the following theme mode to work with
1. AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
This mode is used when we need to select the system assigned mode
2. AppCompatDelegate.MODE_NIGHT_NO
This mode is used when we need to set the Light mode in the app
3. AppCompatDelegate.MODE_NIGHT_YES
This mode is used when we need to set the Dark mode in the app
and to set the theme we need to add one of the above in following method
AppCompatDelegate.setDefaultNightMode(SELECTED THEME HERE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment