Android APIs
public class

RadioButton

extends CompoundButton
java.lang.Object
   ↳ android.view.View
     ↳ android.widget.TextView
       ↳ android.widget.Button
         ↳ android.widget.CompoundButton
           ↳ android.widget.RadioButton
Known Direct Subclasses

Class Overview

A radio button is a two-states button that can be either checked or unchecked. When the radio button is unchecked, the user can press or click it to check it. However, contrary to a CheckBox, a radio button cannot be unchecked by the user once checked.

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.

See the Radio Buttons guide.

XML attributes

See CompoundButton Attributes, Button Attributes, TextView Attributes, View Attributes

Summary

[Expand]
Inherited XML Attributes
From class android.widget.CompoundButton
From class android.widget.TextView
From class android.view.View
[Expand]
Inherited Constants
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
RadioButton(Context context)
RadioButton(Context context, AttributeSet attrs)
RadioButton(Context context, AttributeSet attrs, int defStyleAttr)
RadioButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Public Methods
CharSequence getAccessibilityClassName()
Return the class name of this object to be used for accessibility purposes.
void toggle()
Change the checked state of the view to the inverse of its current state

If the radio button is already checked, this method will not toggle the radio button.

[Expand]
Inherited Methods
From class android.widget.CompoundButton
From class android.widget.Button
From class android.widget.TextView
From class android.view.View
From class java.lang.Object
From interface android.widget.Checkable
From interface android.view.ViewTreeObserver.OnPreDrawListener
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.accessibility.AccessibilityEventSource

Public Constructors

public RadioButton (Context context)

Added in API level 1

public RadioButton (Context context, AttributeSet attrs)

Added in API level 1

public RadioButton (Context context, AttributeSet attrs, int defStyleAttr)

Added in API level 1

public RadioButton (Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)

Added in API level 21

Public Methods

public CharSequence getAccessibilityClassName ()

Added in API level 23

Return the class name of this object to be used for accessibility purposes. Subclasses should only override this if they are implementing something that should be seen as a completely new class of view when used by accessibility, unrelated to the class it is deriving from. This is used to fill in AccessibilityNodeInfo.setClassName.

public void toggle ()

Added in API level 1

Change the checked state of the view to the inverse of its current state

If the radio button is already checked, this method will not toggle the radio button.