1
I have a set of checkbox
but only wanted a selected one and, if they selected another, the one that was selected.
I’ve tried that, but it doesn’t work:
if (chkfemenino.isChecked()) {
params.add(new BasicNameValuePair("genero", generofem));
chkmasculino.setChecked(false);
}
if (chkmasculino.isChecked()) {
params.add(new BasicNameValuePair("genero", generomasc));
chkfemenino.setChecked(false);
}
It is simple to just desilect when selecting the other. It has to be in the
onClick
of eachcheckbox
.– Jorge B.
That is, when you click on
chkfemenino
is that you put thechkmasculino
tofalse
.– Jorge B.
Or use a
RadioButton
.– ramaral
yes I’ve thought about the radiobutton but kind would really prefer checkboxs.. if it were possible..
– Vasco Antunes
The question is valid as knowledge about manipulating events in checkboxes, but I agree with @ramaral: use radiobuttons. The user may have different preferences from your, but mainly remember that the components exist for different purposes (capture only one or multiple choices). Thus, there is a standardization of behavior that is denoted by distinctions in component designs (checkboxes are usually square and scratched, radiobuttons are usually round and filled), which is expected by users. Changing this can cause confusion in users.
– Luiz Vieira
luis the only problem that I will want in my program options of multiple choice and options only one choice and not for different things that wanted only checkboxs
– Vasco Antunes
Yeah, I get it. My only point is that by doing this you will be going against a well-established user interaction approach, which uses checkboxes for multiple choices and radiobuttons for unique choices. And, excuse my sincerity, but the motivation for this seems to be just your personal preference. You can do as you prefer (the program is yours), but just note that this can cause confusion or some discomfort to your users, discouraging the use of the program. :)
– Luiz Vieira
Look at the type of user usability/experience problem that does not follow these conventions can generate: http://www.nngroup.com/articles/checkboxes-vs-radio-buttons/
– Luiz Vieira
Just to show that even the visual quality (artistic) can be worked without changing the convention, one more link for you (see the accepted answer). : ) http://ux.stackexchange.com/questions/12512/are-round-check-boxes-confusing-or-an-accepted-standard?rq=1
– Luiz Vieira