Questions tagged [android-radiogroup]

This class is used to create a multiple-exclusion scope for a set of radio buttons. Checking one radio button that belongs to a radio group unchecks any previously checked radio button within the same group.

This class is used to create a multiple-exclusion scope for a set of radio buttons. Checking one radio button that belongs to a radio group unchecks any previously checked radio button within the same group.

Intially, all of the radio buttons are unchecked. While it is not possible to uncheck a particular radio button, the radio group can be cleared to remove the checked state.

The selection is identified by the unique id of the radio button as defined in the XML layout file.

XML Attributes

See RadioGroup Attributes, LinearLayout Attributes, ViewGroup Attributes, View Attributes

Useful links

315 questions
107
votes
7 answers

Set selected index of an Android RadioGroup

Is there a way to set the selected index of a RadioGroup in android, other than looping through the child radiobuttons and selecting checking the radio button at the selected index? Note: I am populating the Radio Button Group at run time.
Hassan Mokdad
  • 5,832
  • 18
  • 55
  • 90
63
votes
6 answers

Android: RadioGroup - How to configure the event listener

From my understanding, to determine if a checkbox is "clicked" and find if it's checked or not, code such as the following can be used: cb=(CheckBox)findViewById(R.id.chkBox1); cb.setOnCheckedChangeListener(this); public void…
Ryan
  • 9,821
  • 22
  • 66
  • 101
35
votes
6 answers

Creating RadioGroup programmatically

I'm getting an Error while working with the following code Error: The specified child already has a parent you must call removeView on the child's parent first Anyone please help me in resolving this Error: RadioButton[] radiobutton = new…
34
votes
5 answers

How to bind method on RadioGroup on checkChanged event with data-binding

I was searching over the internet for how to perform the new cool android data-binding over the RadioGroup and I didn't find a single blog post about it. Its a simple scenario, based on the radio button selected, I want to attach a callback event…
kirtan403
  • 7,293
  • 6
  • 54
  • 97
32
votes
8 answers

How to set only one RadioButton Can be selected at the time in RadioGroup

I've created a radio button in radiogroup, but when I try running the apps all radio button can be selected all the time, and how to set only one radiobutton can be selected at one time? I'm using Fragment RadioGroup radioGroup = (RadioGroup)…
F_X
  • 491
  • 2
  • 7
  • 16
16
votes
2 answers

Using @OnCheckedChanged (ButterKnife) with radioGroup gives error in android

i recently integrated butterknife in my android project, and now i am trying to use @OnCheckedChanged annotation for radiogroup. but getting error of not giving callback. So what is the right method to call and get checkedId or this one is for…
Niki
  • 1,566
  • 1
  • 19
  • 36
14
votes
6 answers

Radio Button is only partially checked

I know this sound weird so here is the picture. It hold the correct value. The correct radiobutton is (partially) selected. All logic in the OnCheckedChangeListener is executed correctly. I'm completly stunned. Why is the radio button not fully…
Robin Dijkhof
  • 18,665
  • 11
  • 65
  • 116
9
votes
3 answers

Radio Button setChecked/setSelected not working

I have a list view with a text and 3 radio button. If i select any radio button, and scroll the list the radio button gets un-selected. I am maintaining the ID of items for which radio button is selected and in adapter Getview setting the required…
Gaurav
  • 535
  • 1
  • 8
  • 28
9
votes
3 answers

Radiogroup in recyclerview

I am having a recyclerview where each list item has a radiogroup with 4 radio buttons. How can I store the state of each radiogroup correctly. Here is my code. On scrolling up/down the states are incorrects. Thanks public class ElementListAdapter…
sujithvm
  • 2,351
  • 3
  • 15
  • 16
8
votes
5 answers

How to force RadioGroup to select only one RadioButton at a time programatically?

I am designing customize form programmatically where user can put a question and can add multiple options using radio buttons. I have taken RadioGroup and i am adding radio buttons in it. But while selecting i want only one radio button get selected…
Snehal
  • 233
  • 1
  • 3
  • 13
7
votes
3 answers

RadioButton is leaving black checked circle after unchecking

My RadioButtons in my RadioGroup are leaving a black checked circle after I uncheck them or click on another RadioButton in the group. How do I prevent this from happening?
DIRTY DAVE
  • 2,523
  • 2
  • 20
  • 83
7
votes
1 answer

Can i have a Linear layout inside RadioGroup to hold radio button?

I want to have a Customized Radio Group view. So i have created xml view as below
Chandrakanth M
  • 299
  • 1
  • 4
  • 10
6
votes
3 answers

How to get checked radio button's id created dynamically in android

In my activity, I am creating a dynamic radiogroup. I have some questions and answers in Sqlite database, retrieving them in activity and then set in RadioGroup. This is working fine. But after that, I want to get all ID of selected radio button by…
5
votes
1 answer

How to speed up or turn off animation of RadioButton on Android?

I have a RadioGroup with dynamically added RadioButtons. In my Activity, I close the activity immediately after a RadioButton is selected. However, this leads to an artifact where two RadioButtons look like they are selected before the Activity…
VIN
  • 6,385
  • 7
  • 38
  • 77
5
votes
3 answers

Radio Button findViewById within a Fragment

I have looked around and implemented some of the things that I have found in order to get the findViewById to work inside my Fragment. However, I get either the cannot resolve method findViewById or I get "Unreachable Statement." I am not entirely…
1
2 3
20 21