hi
the problem by changing the checkbox checked value to true/false in code is that it will raise its CheckedChange event.
i can use a global variable to check if i changed it or the user clicked on it but i think it is not the best way to do it.
what i have found is that the checkbox view also has a click event (not in b4a) so it would be great if we would have such thing.
https://stackoverflow.com/questions...h-checkbox-value-is-changed-by-user-or-progra
the problem by changing the checkbox checked value to true/false in code is that it will raise its CheckedChange event.
i can use a global variable to check if i changed it or the user clicked on it but i think it is not the best way to do it.
what i have found is that the checkbox view also has a click event (not in b4a) so it would be great if we would have such thing.
Answer 2:
A very simple answer:
Use on OnClickListener instead of OnCheckedChangeListener
someCheckBox.setOnClickListener(newOnClickListener(){
@Overridepublicvoid onClick(View v){// you might keep a reference to the CheckBox to avoid this class castbooleanchecked=((CheckBox)v).isChecked();
setSomeBoolean(checked);}
});
Now you only pick up click events and don't have to worry about programmatic changes.
https://stackoverflow.com/questions...h-checkbox-value-is-changed-by-user-or-progra