質問

I need to have a single radiobutton that I can check and uncheck.

But from my readings on stack overflow, the radio button will stay checked once it is checked as on option needs to be selected?

Here is my code so far:

            RadioButton rButton = new RadioButton(getActivity());
            rButton.setText(listItems.get(i));
            rButton.setId(i);
            rButton.setChecked(false);
            rButton.setClickable(true);
            // rButton.setOnClickListener(new View.OnClickListener() {
            // @Override
            // public void onClick(View v) {
            // RadioButton rButton = (RadioButton)
            // layout.findViewById(position);
            // rButton.setChecked(!rButton.isChecked());
            // }
            // });              
            layout.addView(rButton);

it does work even with the commented out onclick listener.

How can i get the radio button to uncheck?

役に立ちましたか?

解決

I think you need a CheckBox Instead.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top