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 ) ; } } } ; }
Creates and returns a listener which allows to change the preference s value depending on the preference s switch s state .