An Android checkbox listener (setOnCheckedChangeListener/OnCheckedChangeListener example)

Here’s some source code for a simple Android checkbox setOnCheckedChangeListener/OnCheckedChangeListener example:

checkBox = (CheckBox)v.findViewById(;

checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        // update your model (or other business logic) based on isChecked

That checkbox code is pretty generic, so hopefully you can copy and paste it into your own Android application as needed.