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
Asked
Active
Viewed 2,677 times
3
-
Does this answer your question? https://stackoverflow.com/questions/63777438/how-to-avoid-forced-dark-theme-in-my-app-when-devices-can-force-it-at-app-level – null_override Nov 03 '20 at 05:45
1 Answers
9
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);

Umair Iqbal
- 1,959
- 1
- 19
- 38
-
1MAKE SURE to set it BEFORE the "setContentView(R.layout.activity_main);" line. – Kleysley Jul 22 '21 at 12:04