title: Android radio button multiple select
body: <p>Long story short. I am creating radio buttons inside radio group. I will do filtering for my table depending on what user selects. I have one radio button checked by default. So when I try to check other button it stays checked. In fact both buttons get checked. It is so weird. Maybe that is happens because I do everything programmatically. Desing is still in progress. I just stoped here because I don't know if it is visual bug or not. I am using Kotlin for android developemnt. </p>
  
  <p>Display buttons:</p>
  
  <pre><code>    private fun displayChoices(choices: List&lt;FiltersList.Choice&gt;, multipleChoice: Boolean) {
          val radioGroup = RadioGroup(this)
          for (choice in choices) {
              val button = if (multipleChoice) {
                  CheckBox(this)
              } else {
                  RadioButton(this)
              }
  
              button.apply {
                  layoutParams = LinearLayout.LayoutParams(
                      LinearLayout.LayoutParams.WRAP_CONTENT,
                      LinearLayout.LayoutParams.WRAP_CONTENT).apply {
                      setMargins(16, 8, 16, 8)
                  }
                  text = choice.display
                  isChecked = choice.selected
                  setTextColor(ResourcesCompat.getColor(resources, R.color.colorTextClicked, null))
                  if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) {
                      buttonTintList = ColorStateList.valueOf(ResourcesCompat.getColor(resources, R.color.colorButton, null))
                  }
              }
              radioGroup.addView(button)
          }
          filters_content.addView(radioGroup)
      }
  </code></pre>
  
  <p>My layout:</p>
  
  <pre><code>&lt;androidx.coordinatorlayout.widget.CoordinatorLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:background="@color/colorFilterBoxBackground"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".FilterDialogActivity"&gt;
  
      &lt;ScrollView
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
          &lt;LinearLayout
              android:id="@+id/filters_content"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              app:layout_behavior="@string/appbar_scrolling_view_behavior"
              android:orientation="vertical"&gt;
  
          &lt;/LinearLayout&gt;
  
      &lt;/ScrollView&gt;
  
  &lt;/androidx.coordinatorlayout.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p>The view:
  <img src="https://i.ibb.co/Dz6ZHp7/87544682-2557341711211714-3388003617653915648-n.jpg" alt="Problem looks like this"></p>
  
  <p>I select Any Date button programmatically and it is stay selected. I get data from the server which items need to be seleced by default.</p>