mercredi 12 février 2020

setOnCheckedChangeListener cannot resolve symbol in Check Box

I'm trying to make a button that is disabled until you check the checkbox

Button mButton=(Button)findViewById( R.id.registerBut);
    CheckBox mCheckBox= findViewById( R.id.checkBox);

mCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        mButton.setEnabled(isChecked);
    }
});

setOnCheckedChangeListener and CompoundButton buttonView says- "cannot resolve symbol" ,
new OnCheckedChangeListene says - "Invalid method declaration; return type required"

If you could please help me solve this. Thanks in advance :)




Aucun commentaire:

Enregistrer un commentaire