2
Hello, I am using a Checkbox and I would like that if it was Checked, it becomes visible a Layout. I’m using the code below and it only works for when it is clicked, but I already want to leave it checked. I tried to get the code out of the . setOnCheckedChangeListener, but it didn’t work. Does anyone know what might be going on? Thank you
cbx22.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (cbx22.isChecked()) {
layhorario.setVisibility(View.VISIBLE);
} else {
layhorario.setVisibility(View.GONE);
}
}
});
Hi I’m already setting it checked, but then it doesn’t work. Still, I have to uncheck and check again.
– Elaine Breda Schwaner