OnPreferenceClickListener work wrong in CheckBoxPreference

61 views Asked by At

I have an CheckBoxPreference and i setOnPreferenceClickListener

mCheckBoxPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            mCheckBoxPreference.setChecked(!mCheckBoxPreference.isChecked());
            Toast.makeText(getActivity(), "Some text", Toast.LENGTH_SHORT).show();
            return false;// if return true, is always set checked flase
        }
    });

But when click checkbox it is always set checked true. I dont know why !

0

There are 0 answers