Response to Android Settings Updates

I call PreferenceActivity from another action, and then update the application state (i.e. changing the font size) to onActivityResult based on the changes in preferences.

I thought it would be better to put the state update logic in PreferenceActivity. Thus, I have no duplicate logic in every action that calls PreferenceActivity.

What is the best or right way to do this?

+3
source share
2 answers

Is there any Activity(or other component) that is interested in preference changes that the preference change listener registers through registerOnSharedPreferenceChangeListener(). Then, when the settings change in any way, they learn about it and can react accordingly.

+7
source

The PreferenceActivity function should handle all preference settings. In your other actions, you should read that these settings are when they are started and adjusted accordingly.

0
source

Source: https://habr.com/ru/post/1743625/


All Articles