I would like to do a small upgrade of my application and I would like the theme to change to dark mode after pressing SwitchPreference. I need a detailed guide or someone to explain to me exactly how to do it. If I am just learning to do something in SettingsFragment but it does not come easily to me, please help. If you do not understand the question, please write in the comments, I will try to explain everything so that the help is the best
Asked
Active
Viewed 349 times
1
-
See how to store data https://www.google.com/amp/s/www.androidauthority.com/amp/how-to-store-data-locally-in-android-app-717190/ – Yo Daniel Sep 14 '21 at 11:34
1 Answers
0
I don't think this is the easiest way but you can give it a shot. What you will do is to save a shared preference I will call it theme. And set it to light or dark based on user preference. Then in homepage on create method call the shared preference and set your app theme based on what your user have set already.
I don't know if you get the idea but this is best I can explain..

Yo Daniel
- 114
- 11
-
and would you give me some tutorial on how to do it or documentation – MaksChojniak1 Sep 14 '21 at 11:27
-
See how to store data https://www.google.com/amp/s/www.androidauthority.com/amp/how-to-store-data-locally-in-android-app-717190/ – Yo Daniel Sep 14 '21 at 11:34
-
-