public void addListener(final OnSettingChangedListener listener){
synchronized (mLock) {
    if (listener == null) {
      throw new IllegalArgumentException("OnSettingChangedListener cannot be null.");
    }
    if (mListeners.contains(listener)) {
      return;
    }
    mListeners.add(listener);
    OnSharedPreferenceChangeListener sharedPreferenceListener=getSharedPreferenceListener(listener);
    mSharedPreferenceListeners.add(sharedPreferenceListener);
    mDefaultPreferences.registerOnSharedPreferenceChangeListener(sharedPreferenceListener);
    if (mCustomPreferences != null) {
      mCustomPreferences.registerOnSharedPreferenceChangeListener(sharedPreferenceListener);
    }
    Log.v(TAG,"listeners: " + mListeners);
  }
}

public void addListener ( final OnSettingChangedListener listener ) { synchronized ( mLock ) { if ( listener == null ) { throw new IllegalArgumentException ( "OnSettingChangedListener cannot be null." ) ; } if ( mListeners . contains ( listener ) ) { return ; } mListeners . add ( listener ) ; OnSharedPreferenceChangeListener sharedPreferenceListener = getSharedPreferenceListener ( listener ) ; mSharedPreferenceListeners . add ( sharedPreferenceListener ) ; mDefaultPreferences . registerOnSharedPreferenceChangeListener ( sharedPreferenceListener ) ; if ( mCustomPreferences != null ) { mCustomPreferences . registerOnSharedPreferenceChangeListener ( sharedPreferenceListener ) ; } Log . v ( TAG , "listeners: " + mListeners ) ; } }
add an onsettingchangedlistener to the settingsmanager , which will execute onsettingschanged when any sharedpreference has been updated .
