title: How to get notified on CheckBoxPreference state change?
body: <p>I need to set/unset listener dynamically in response to a <a href="http://developer.android.com/reference/android/preference/CheckBoxPreference.html" rel="nofollow noreferrer">Preference CheckBox</a> user setting change.</p>
  
  <p>One approach I have seen is to use <a href="https://stackoverflow.com/questions/9719541/preferenceactivity-using-onsharedpreferencechanged">onSharedPreferenceChanged()</a> and check for that checkbox's key.</p>
  
  <p>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 <code>PreferenceActivity</code>. Perhaps <a href="http://developer.android.com/reference/android/preference/PreferenceActivity.html#onContentChanged%28%29" rel="nofollow noreferrer">onContentChanged()</a>?</p>
  
  <p>Which approach would you recommend and why? </p>
  
  <p>Can you point to a sample working code?</p>