A radio button is a two-states button that can be either checked or unchecked.

These two states button are also normally generally called Compound buttons.

And indeed they derive from Android.Widget.CompoundButton, an abstract class that acts as an interface definition for a callback to be invoked when the checked state of a compound button changed.

So in a way a radiobutton share a similarity with CheckBox by deriving from the CompoundButton.

However, one big difference with CheckBox is that a RadioButton, unlike a CheckBox cannot be unchecked when it’s already checked.

Say you have two radiobuttons: one maleRadioButton and the other femaleRadioButton. If you check male you expect female to be unchecked obviously.

However, if you click male twice, don’t expect it to get unchecked. You have to move over to the female and then given that we have them in a RadioGroup, the female gets checked while the male gets unchecked.

You can check our video tutorial here:

RadioButton Definition

RadioButton is defined in the Android.Widget namespace:

namespace Android.Widget

That namespace belongs to the mono.Android assembly.

RadioButton is a concrete class that derives Android.Widget.CompoundButton:

public class RadioButton : Android.Widget.CompoundButton

On it’s own RadioButton doesn’t have any public method or public properties.

Instead it gets them via Inheritance from the CompoundButton class.

Important Properties and Methods

Here are some of the important properties of RadioButton

Property Type Description
public virtual bool Checked { set; get; } Property Get or Set checked state of the button.This actually defined in the CompoundButton class.
public virtual void Toggle() Method Changes the checked state of the view to the inverse of its current state. Also defined in the CompoundButton class.
public event System.EventHandler<CompoundButton.CheckedChangeEventArgs> CheckedChange Event Raised when the checked state of the RadioButton is detected.Also defined in the CompoundButton class.

Just the similar properties, events and methods that CheckBox gets.


On their own, it would be difficult to juggle the states of many RadioButtons. This is because normally you expect only one radio button to be checked at any givem time.

This forces users to select only one item.

So there is a class called RadioGroup defined in the Android.Widget namespace that allows us easily work with many RadioButtons.

This is because when you add your RadioButtons inside a RadioGroup, then checking one radio button unchecks all the others.

RadioGroup derives from Android.Widget.LinearLayout:

public class RadioGroup : Android.Widget.LinearLayout

RadioGroup Important Properties,Methods and Events

Here are some important properties, methods and events for the RadioGroup class:

Property Type Description
public virtual int CheckedRadioButtonId { get; } Property Returns the identifier of the selected radio button in this group. Upon empty selection, the returned value is -1.
public virtual void Check(int id) Method Sets the selection to the radio button whose identifier is passed in parameter. Using -1 as the selection identifier clears the selection; such an operation is equivalent to invoking ClearCheck(). You pass the unique id of the radiobutton to select.
public virtual void ClearCheck() Method Clears the selection. When the selection is cleared, no radio button in this group is selected and CheckedRadioButtonId returns null.
public event System.EventHandler<RadioGroup.CheckedChangeEventArgs> CheckedChange Event Raised when the checked state of the radiobuttons in the group changes.

Example – Creating RadioButtons and RadioGroup Programmatically without XML

We’ll now see an example. First we will programmatically instantiate several RadioButtons and one radiogroup, add the radiobutton in the radiogroup, and listen to checkChange events thus showing a Toast message with selected items it.

Creating RadioGroup and RadioButtons with XML, then getting Text from Selected RadioButton

In this example we will see how to add the RadioGroup in our XML layout, add the RadioButtons to it, then in our C# code, when a radioButton is selected, show it’s selected Text in a Toast message.


Here’s our XML Layout code:


Here’s our MainActivity



Good day.