If you are using UiModeManager to turn on CarMode and NIGHT, set to AUTO. You can get a link to the current topic used when declaring an attribute to search at runtime.
attrs.xml
<resources> <attr name="metaThemeName" format="string"/> </resources>
night values /themes.xml
<?xml version="1.0" encoding="utf-8"?> <resources xmlns:tools="http://schemas.android.com/tools"> <style name="AppTheme" parent="Theme.AppCompat"> <item name="metaThemeName">night</item> </style> </resources>
java.class
... TypedValue outValue = new TypedValue(); getTheme().resolveAttribute(R.attr.metaThemeName, outValue, true); boolean isNight="night".equals(outValue.string); ...
Touchboarder
source share