Note that there are some explanatory texts on larger screens.

plurals
  1. POradiogroup behavior on orientation change
    primarykey
    data
    text
    <p>I am hoping that someone can help me understand what's going on with respect to an Android radiogroup and the onCheckedChanged callbacks when the orientation changes.</p> <p>I have a radio group with three radio buttons. The second button is defined as the default by setting the checked attribute to true. My xml for the radio group is as follows:</p> <pre><code> &lt;RadioGroup android:id="@+id/rgReportRange" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="horizontal" &gt; &lt;RadioButton android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/One" /&gt; &lt;RadioButton android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:text="@string/Two" /&gt; &lt;RadioButton android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/Three" /&gt; &lt;/RadioGroup&gt; </code></pre> <p>The RadioGroup has an onCheckedChangedListener. When the orientation changes, the onCheckedChangedListener is being called back differently based on which button is selected before the orientation change.</p> <p>If button1 is selected, I see one callback to the onCheckedChanged method with checkedID equal to button1.</p> <p>If button2 is selected, I see no callback to the onCheckedChanged method.</p> <p>If button3 is selected, I see two callbacks to the onCheckedChanged method. The first callback has checkedID equal to button2. The second callback has checkedID equal to button3.</p> <p>I don't understand the difference in behavior between the first and third cases. In both, there is a radio button other than the default selected.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload