In Java, I need to test that at least 1 of 2 radio groups (radiogroup1 and radiogroup2) is not empty when clicking on a button (i.e., all radio buttons shall not be empty AND at least one radio button is pressed).
The code structure would be something like:
button is pressed {
if (radiogroup1 not empty) or (radiogroup2 not empty) {
//do something
}
}
If both radiogroups are empty, nothing happens when the button is pressed.
Now, I set up something like this:
if (RadioGroup.getCheckedRadioButtonId() == -1 || RadioGroup2.getCheckedRadioButtonId() == -1) {
//do something
}
but I need actually exactly the opposite. I don't succeed to invert the condition with != or something else.
Any help appreciated!
Aucun commentaire:
Enregistrer un commentaire