I'm trying to enable Dark Mode on emulator (with Android API 28), but after I choose "Dark" Theme on emulator in Settings,
nothing is changed, except of setting value:
Is it possible at all to enable Dark Mode on emulator?
Answer by @MihailFleytman and improved by @AchrafAmil on Android StackExchange.
No reboot/root required
adb shell "cmd uimode night yes"
adb shell "cmd uimode night no"
According to Google
Dark theme is available in Android 10 (API level 29) and higher.
For me, it was easier to install an emulator with API level 29.
It works like a charm.
https://developer.android.com/guide/topics/ui/look-and-feel/darktheme
On Android 10 go to Display
-> Dark Theme
and switch the toogle, in order to activate that.
The closest to a system dark theme
I achieved on 28 was only for the background of the apps menu (homepage screen) to be either light or dark. And I could only achieve that after I switched to setting "Automatic based on wallpaper", changing wallpaper to a dark, watch it change (see attachments). Then dark and light modes started working as if they were unlocked.
Homescreen in mode dark api 28
Homescreen in mode light api 28
I'd say real system dark theme is only working as intended in preview Q and up. And ofc, apps developed to support dark theme will all the way down to 14.
I had this same question. My app detected and applied dark mode fine on an Android 9.0 device, but even with "Dark" theme enabled in the 9.0 emulator, nothing happened, and I initially thought it was broken.
I don't know if the theme setting actually does anything for the earlier emulators, but, yes, the theme setting works as expected on an Android 10.0 emulator as indicated by the other answers.
https://developer.android.com/guide/topics/ui/look-and-feel/darktheme
Have you tried to activate the battery saver? If using an android simulator, dark mode will be active after battery saver is activated
I've tried on android simulator Nexus 5x API 28
So the steps are
Thanks
Reference: developer android dark theme
getNightMode()
is alwaysMODE_NIGHT_NO
, but it's settable withsetNightMode(MODE_NIGHT_YES)
. Have you figured it out yet?