Questions tagged [android-radiobutton]

Use for the android.widget.RadioButton element. Radio buttons are normally used together in a RadioGroup.

Radio buttons allow the user to select one option from a set. You should use radio buttons for optional sets that are mutually exclusive if you think that the user needs to see all available options side-by-side.

Radio buttons are normally used together in a RadioGroup. When several radio buttons live inside a radio group, checking one radio button unchecks all the others.

Useful links

347 questions
0
votes
1 answer

setting radio button for different task

I am trying to show radio group in a dialog and when the radio button is clicked it will set some data in shared preference. I am able to make toast when any button is clicked but I want to do something when different button is clicked .I tried…
Neelay Srivastava
  • 1,041
  • 3
  • 15
  • 46
0
votes
0 answers

Why can I select all radio buttons in an Android CheckedList?

I'm very, very new to Android, so I'm following tutorials and examples everywhere. First I was told the user needs to select multiple files, so I created this list view, and selection worked as expected, with check boxes to the left of each list…
ProfK
  • 49,207
  • 121
  • 399
  • 775
0
votes
1 answer

Android RadioGroup. Forced buttons in one column?

I want a RadioGroup with various RadioButtons displayed in two columns. But it seems that RadioGroup forces the RadioButtons to be displayed in just one column. Is there a way to get the buttons displayed in two columns? For example, this xml code…
0
votes
3 answers

Android: A specific RadioButton belongs to which RadioGroup?

Is it possible to identify for which Radio Group a specific Radio Button belongs to in Android? Eg: RadioGroup_A - RadioButton_1A - RadioButton_2A RadioGroup_B - RadioButton_1B - RadioButton_2B When I have RadioButton_1A, to…
JibW
  • 4,538
  • 17
  • 66
  • 101
0
votes
3 answers

How to display a text when the radio button clicked?

So I have a radio group with 2 radio buttons, when user select the first one it's going to display a text under the radio group, if user selects the second one it's going to display different message on the same area. It's really easy to do this…
Ege Kuzubasioglu
  • 5,991
  • 12
  • 49
  • 85
0
votes
0 answers

Getting Index from RadioButtons(None are selected) inside RadioGroup from Value

I was wondering how to get the index of radiobutton inside of radiogroup. The problem is that i get from API a Value(Apple, Banana, PineApple,etc), and I have the RadioButtons ready, named Apple, Banana, PineApple. How can I get the index of RB, so…
WinterChilly
  • 1,549
  • 3
  • 21
  • 34
0
votes
0 answers

RadioGroup.check() make OnCheckedChangeListener.onCheckedChanged called twice

I have some RadioButtons in a RadioGroup, and I set OnCheckedChangeListener to the RadioGroup like this: public class RadioGroupActivity extends AppCompatActivity { @Bind(R.id.radio_a) RadioButton radioA; @Bind(R.id.radio_b) …
L. Swifter
  • 3,179
  • 28
  • 52
0
votes
3 answers

How do I change color of RadioButtons in PopupMenu?

How do I set the color of RadioButtons in a checkable PopupMenu. I am using the AppCompat version. I successfully set the background color and the text color via the styles, but I cannot figure out how to set the color of the radio buttons. This is…
lionscribe
  • 3,413
  • 1
  • 16
  • 21
0
votes
2 answers

How to decrease the size of an Image on a RadioButton to a desired size in Android?

I am trying to form 3 radio buttons with Image on them. So I have used the XML attribute android:button. But since my image size is too big, I can't see it fit in the button. Following is my XML code:
Auro
  • 1,578
  • 3
  • 31
  • 62
0
votes
2 answers

Custom Radio Buttons in Alert Dialog are never checked

I have a custom AlertDialog with radio buttons which will open on click of a textview. Everything is working as it is supposed to except that the radio buttons are never shown as "checked". Whenever I open the AlertDialog all of the buttons are…
jlively
  • 735
  • 2
  • 9
  • 29
0
votes
1 answer

I want a alert dialog to come up when a radio button is checked

I have a radio group with 4 radio buttons. And i want alert dialog to pop when either one of two particular radio buttons is checked. How can i Achieve this??
0
votes
2 answers

How to align Radio Button text in Android?

New to android.I am using radio Button in my android app questionbtnD = (RadioButton)findViewById(R.id.optionD); questionbtnD.setText(Html.fromHtml(dq.get(id).getOptions().get(3).toString().trim())); and text coming is like Won't…
Bat
  • 135
  • 2
  • 9
0
votes
2 answers

RadioGroup retrieve is null

I try to retrieve my RADIOGROUP for check which Radio Button is checked. For this, I use this code in onCreate() : /** * @param savedInstanceState */ @Override protected void onCreate(Bundle savedInstanceState) { …
0
votes
2 answers

Android: RadioButton with two lines does not keep padding/margin

I have an XML with a RadioGroup and I'm programmatically adding RadioButton to the RadioGroup. Nevertheless, in my RadioButtons I want to have items with two lines text, such as Category name\nand parent category. Unfortunately, for some reason, the…
noloman
  • 11,411
  • 20
  • 82
  • 129
0
votes
0 answers

Attempt to Invoke Virtual method RadioButton.gettext() on a null object Reference

I am creating login/register page in a tabbed view. I am getting error on RadioButton from gertting the text of checked radiobutton. My Fragment class: package com.example.sqlitetest.fragments; import android.app.AlertDialog.Builder; import…
Krups
  • 407
  • 6
  • 13