I cannot find any tutorials on checkbox preference. I can use a listpreference, but I can\'t use checkbox preference. For now, I want that if user sets on the checbox, a toa
You can cast the value of the checkbox into a boolean. This might be safer and more extensible than checking the toString() value.
final CheckBoxPreference checkboxPref = (CheckBoxPreference) getPreferenceManager().findPreference("checkboxPref");
checkboxPref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
if(newValue instanceof Boolean){
Boolean boolVal = (Boolean)newValue;
}
return true;
}
});