Questions tagged [appcompatdelegate]

4 questions
4
votes
1 answer

Android AppCompatDelegate.setDefaultNightMode not recreating parent activity in android 9

Hello I am using this AppCompatDelegate to change between day/night themes I have 2 activities A& B this code called from activity B it should recreating activity B & A with the chosen style here is my code applyNight.setOnClickListener(new…
2
votes
2 answers

System applies night mode to views added in service (TYPE_APPLICATION_OVERLAY), but how to apply night mode manually?

I have a LinearLayout that I inflate and add to screen from a service as TYPE_APPLICATION_OVERLAY. This view changes to dark mode when I change the theme from system settings for the whole phone. But when I want to set the night mode manually in my…
1
vote
2 answers

how the setting of AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM relate to result of getResources().getConfiguration().uiMode

when using getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK to check what mode the app is currently in, int currentNightMode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK switch…
lannyf
  • 9,865
  • 12
  • 70
  • 152
0
votes
1 answer

Change source color file for dark mode programmatically Android

I'm trying to implement dark mode for my application. I created two different file color.xml (the second with color of my dark mode). I saved in boolean if my switch is on/off using sharedPreferences, when I click the switch button color changed,…