title: Android Radio Button not working properly
body: <p>I am trying to make a math app for little kids. And there is kind of an activity to customize the settings of the math questions. (number of digits, + or -, whether timer is enabled etc.) And I am doing the number of digits part. Here's my layout:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  xmlns:tools="http://schemas.android.com/tools"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:paddingLeft="@dimen/activity_horizontal_margin"
                  android:paddingRight="@dimen/activity_horizontal_margin"
                  android:paddingTop="@dimen/activity_vertical_margin"
                  android:paddingBottom="@dimen/activity_vertical_margin"
                  tools:context=".MainActivity"
                  android:layout_gravity="center_horizontal"
                  android:orientation="vertical"&gt;
      &lt;ScrollView
          android:layout_width="match_parent"
          android:layout_height="0dp"
          android:id="@+id/customize_menu"
          android:layout_weight="9"&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical"&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="@string/digit_text"
                  android:textSize="@dimen/customize_menu_title"/&gt;
  
              &lt;RadioGroup
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:orientation="horizontal"&gt;
  
                  &lt;RadioButton
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="1"
                      android:textSize="@dimen/customize_menu_radio"
                      android:layout_marginLeft="@dimen/radio_button_spacing"/&gt;
  
                  &lt;RadioButton
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="2"
                      android:textSize="@dimen/customize_menu_radio"
                      android:layout_marginLeft="@dimen/radio_button_spacing"
                      android:checked="true"/&gt;
  
                  &lt;RadioButton
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="3"
                      android:textSize="@dimen/customize_menu_radio"
                      android:layout_marginLeft="@dimen/radio_button_spacing"/&gt;
  
              &lt;/RadioGroup&gt;
  
          &lt;/LinearLayout&gt;
  
      &lt;/ScrollView&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="0dp"
          android:orientation="horizontal"
          android:layout_weight="1"&gt;
          &lt;Button
              android:layout_width="0dp"
              android:layout_height="match_parent"
              android:layout_weight="1"
              android:text="@string/button_trophies"/&gt;
          &lt;Button
              android:layout_width="0dp"
              android:layout_height="match_parent"
              android:layout_weight="1"
              android:text="@string/button_start"/&gt;
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>As you can see, I set the radio button with the text "2" to be checked by default. However, when I run the app and click on the radio button "3", both radio button "2" and "3" is checked! Then I tried to click on the radio button "1" and now only radio button "1" and "2" is checked. In other words, whatever radio button I press, radio button "2" is always checked. But that certainly isn't how radio buttons work, right?</p>
  
  <p>Questions: How can I fix this behaviour without changing the fact that the the radio button "2" is checked by default? Why are they having this behaviour?</p>