I know by using AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
night mode can be implemented in an activity. But what I want is that - there'll be an option in settings for activating night mode in all the activities & fragment in the app. How can I do that?
One way to achieve this:
When you select the action night mode in setting activity(or any) you can maintain a flag(& save in sharedpreference or any temp storage).
Check this flag on each and every activity & fragment and if the flag is positive set the night mode as you used,
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);