Solution 1 :
To detect if the system is in dark theme. Helpful.
switch (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) {
case Configuration.UI_MODE_NIGHT_YES:
//process
break;
case Configuration.UI_MODE_NIGHT_NO:
// process
break;
}
Problem :
I need to know if user has enabled dark theme in the OS level so that I can enable dark theme in my app automatically.(not force dark mode)
Comments
Comment posted by Is there an API to detect which theme the OS is using – dark or light (or other)?
Does this answer your question?
Comment posted by Gavin Wright
Just so you know, Android can do this automatically if your app’s theme extends one of the
Comment posted by VIN
are you calling
Comment posted by Rvb84
Activity, the Application context does not contain theme information.