Roman Rdgz Roman Rdgz - 1 year ago 223
Android Question

Android: checkbox listener

I want to put a Listener over a checkBox. I looked for info and it is like this:

satView = (CheckBox)findViewById(;

satView.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(RadioGroup group, int checkedId) {
if (isChecked){
// perform logic


The problem is that Eclipse thinks it's an
for a
and it doesn't work. How can I fix this?

Answer Source

You can do this:

satView.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

       public void onCheckedChanged(CompoundButton buttonView,boolean isChecked) {

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download