Abubakar Ib 2021/09/07 205
The question and answer about this post on Trying to Add Night Mode Feature to my App using Aide ide have a total of 2 answer so far..
Just add this into your apps.
-----
AppDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
----
u can use :
MODE_NIGHT_NO
MODE_NIGHT_AUTO
MODE_NIGHT_FOLLOW_SYSTEM
-----
Change your theme to:
Theme.AppCompat.DayNight
-----
Create a folder named value-night and create styles.xml file and customize your night color inside.
----
Your night mode reset every time you close your app. Use shared preference to store value and load your theme every time your app run..
To check status, u can use :
int mode = AppCompatDelegate.getDefaultNightMode();
you may use setTheme + recreae() for that, then add sharedpreferences to store changes