I need to set/unset listener dynamically in response to a Preference CheckBox user setting change.
One approach I have seen is to use onSharedPreferenceChanged() and check for that checkbox's key.
But somehow this looks to me inefficient. I was thinking more in the direction of setting some kind of listener on the class derived from PreferenceActivity. Perhaps onContentChanged()?
Which approach would you recommend and why?
Can you point to a sample working code?