With OnCheckedChangeListener
you receive an event whenever the checked status changes, even when done in code by using .setChecked()
.
Depending on what you are doing this can lead to unexpected behavior (for example when you have a checkbox in a listview, the view is recycled and the checkbox state is modified programmatically, it looks exactly the same way as if the user had clicked it).
Therefore, when you are writing code that is supposed to react to a user who clicked the checkbox you should use OnClickListener
.