单击我的 CheckboxPreference 时,我需要找到一种切换返回值的方法。我已经在我的 settings.xml 中设置了一个键。点击工作正常,我只是好奇如何在每次点击时返回一个新值。
final Preference disableRemixingPref = (Preference) findPreference("disableRemixing");
disableRemixingPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
// I don't always want to return true here. Basically, on every click I want to return the opposite of what the selection was before.
return true;
}
});