I have an app that displays distances and volumes. I have a SettingsFragment that allows me to choose the units for distance, mile or km, and for volume, gallon or liter. Changing between units works but not right away, I have to flip the phone or reset the app to see the changes. I want the setting change to be reflected right away on the main activity but I'm not sure how to accomplish this. I have done some reseach and found a possible solution: The settings guide suggest that I should implement the OnSharedPreferenceChangeListener interface to listen for changes. But this is implemented on PreferenceFragment and not on a different activity. This is a similar solution.
I'm confused on what is the proper way to listen for the setting change on the main activity and how, when the change happens, I should refresh the view. Can anyone please clarify?