code: private OnCheckedChangeListener createCheckedChangeListener() {
          return new OnCheckedChangeListener() {
  
              @Override
              public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
                  if (getOnPreferenceChangeListener() == null || getOnPreferenceChangeListener()
                          .onPreferenceChange(SwitchPreference.this, isChecked)) {
                      setChecked(isChecked);
                  } else {
                      setChecked(!isChecked);
                  }
              }
  
          };
      }
docs: Creates and returns a listener, which allows to change the preference's value, depending on
  the preference's switch's state.
  
  @return The listener, which has been created, as an instance of the type {@link
  OnCheckedChangeListener}