public void removeAllListeners(){
synchronized (mLock) {
    for (    OnSharedPreferenceChangeListener listener : mSharedPreferenceListeners) {
      mDefaultPreferences.unregisterOnSharedPreferenceChangeListener(listener);
      if (mCustomPreferences != null) {
        mCustomPreferences.unregisterOnSharedPreferenceChangeListener(listener);
      }
    }
    mSharedPreferenceListeners.clear();
    mListeners.clear();
  }
}

public void removeAllListeners ( ) { synchronized ( mLock ) { for ( OnSharedPreferenceChangeListener listener : mSharedPreferenceListeners ) { mDefaultPreferences . unregisterOnSharedPreferenceChangeListener ( listener ) ; if ( mCustomPreferences != null ) { mCustomPreferences . unregisterOnSharedPreferenceChangeListener ( listener ) ; } } mSharedPreferenceListeners . clear ( ) ; mListeners . clear ( ) ; } }
remove all onsharedpreferencechangedlistener ' s . this should be done in ondestroy .
