Reputation: 43
I have this logic in my code
if(r40.isChecked()){
//do this
}
It works great, but I needed the negative, "if rb.isNotChecked" or ".isChecked() = false"
But I cant see to find it, also I can't use the RadioGroup because all my RadioButtons are not inside one, I'm controlling them manually
Upvotes: 1
Views: 9362
Reputation: 2087
I mean you COULD do if(r40.isChecked() == false){
//do something
}
BUT if(!r40.isChecked){
//do something
}
Is much better/cleaner
Upvotes: 1
Reputation:
Try this:
if (! r40.isChecked()) {
//Do something
}
In more detail the exclamation mark added in this code reverses the following code in the same block, causing the code to mean:
if (r40.isNotChecked()) {
//Do something
}
I hope this helped!
Upvotes: 1
Reputation: 2509
Try with negative check
if(!r40.isChecked()){
//do this
}
this check if radio isn`t checked.
Upvotes: 1
Reputation: 1006859
But I cant see to find it
if(!r40.isChecked()){
//do this
}
Upvotes: 2