androidandroid-darkmode

how to forced UI of android app to light mode


if device mode is dark mode then how to forced to our android App UI select light mode .. in my app background is white and text color is black , but in some devices dark mode is enable then background is show as black and text color is also black . how we forced android app to light mode


Solution

  • Paste this line of code in Application class or Splash class

    (you can write it in any class which is first to launch as app is opened)

    AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);