No default radio button selected (J2ME, Java)

Currently working on a mobile app in J2ME and asking questions with response options to the ChoiceGroup radio button. Any suggestion on how to make sure that no default answer is selected? We tried:

cg8.setSelectedIndex( -1, true );

But get an exception thrown error

and

cg8.setSelectedFlags( boolean[] )

with all false but also get another error.

To get around this, we also tried to create an invisible radio button and set it as selected, but also couldn't find a way to make an invisible radio button.

Any thoughts or suggestions would be greatly appreciated !!

+1


source to share


2 answers


It seems to me that the platform enforces the relevant agreement, although I must apologize for taking a purist point of view here; this will not answer your question.



Radio buttons are used when there are multiple exclusive options, of which one must ; so it makes some sense to the UI to ensure that something is always selected. Ideally, the initial choice in a radio group should always be safe and sane by default.

+2


source


As far as I know, the only way to not use the preselected radio button is to make the control itself. Re-install the radio button list with Canvas or CustomItem.

This is a lot of work, unfortunately.



You should look into LWUIT as it may have an intermediate solution.

+1


source







All Articles