0
How to do the treatment in this code so that it returns message to the user select at least one checkbox if it does not select any?
public void verificaCheckBox(){
Listcheck.clear();
if (cbPapel.isChecked())
Listcheck.add(cbPapel.getText().toString());
if (cbPlastico.isChecked())
Listcheck.add(cbPlastico.getText().toString());
if (cbMetal.isChecked())
Listcheck.add(cbMetal.getText().toString());
if (cbVidro.isChecked())
Listcheck.add(cbVidro.getText().toString());
cbSelecionado = (Listcheck.toString());
}
The treatment is working. But when I select more than one, only the first option comes when sending to BD.
– E FRANÇA
I made an edit on my reply, go back to your code then, and at the end of everything, include a new if that will check whether your selected array is empty
– Leonardo Dias