How can I reload SharedPreferences when I resume from one activity to another? If I resume, it is possible that user has changed the settings. Is it possible to reload SharedPreferences or do I need to refresh/reload activity. And if, then how?
How can I reload SharedPreferences when I resume from one activity to another? If
Share
There is no difference in how you get and set
SharedPreferencesnormally and from doing so inonResume. What you will need to do in addition to getting the most recent preferences, is update any objects you have in theActivitythat use preference values. This will ensure yourActivityis working with the most recent values.A simple example: