Detect the Android device theme (is it dark or light)
This might help ContextThemeWrapper
int currentNightMode = getContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
switch (currentNightMode) {
case Configuration.UI_MODE_NIGHT_NO:
// Night mode is not active on device
break;
case Configuration.UI_MODE_NIGHT_YES:
// Night mode is active on device
break;
}