Note that there are some explanatory texts on larger screens.

plurals
  1. POfindViewById returns null for radioGroup but finds the radioButtons?
    primarykey
    data
    text
    <p>I have an Activity that does the following </p> <pre><code>Button distanceSort = (Button) findViewById(R.id.distanceSortButton); Button waitTimeSort = (Button) findViewById(R.id.waitTimeSortButton); Button nameSort = (Button) findViewById(R.id.nameSortButton); Button mapButton = (Button) findViewById(R.id.locationsMapButton); Button dashboardButton = (Button)findViewById(R.id.dashboardButton); RadioGroup sortingGroup = (RadioGroup)findViewById(R.id.sortingRadioGroup); </code></pre> <p>and the xml is this</p> <pre><code>&lt;RadioGroup xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/sortingRadioGroup" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/headerBar" android:layout_centerHorizontal="true" android:checkedButton="@+id/distanceSortButton" android:orientation="horizontal" &gt; &lt;RadioButton android:id="@id/distanceSortButton" style="@style/tabText" android:layout_weight="1" android:background="@drawable/radio_group_selector" android:button="@null" android:checked="true" android:gravity="center" android:text="@string/distance_sort_button" /&gt; &lt;View android:layout_width="1dp" android:layout_height="48dp" android:background="@drawable/tab_separator" /&gt; &lt;RadioButton android:id="@+id/waitTimeSortButton" style="@style/tabText" android:layout_weight="1" android:background="@drawable/radio_group_selector" android:button="@null" android:gravity="center" android:text="@string/wait_time_sort_button" /&gt; &lt;View android:layout_width="1dp" android:layout_height="48dp" android:background="#464646" /&gt; &lt;RadioButton android:id="@+id/nameSortButton" style="@style/tabText" android:layout_weight="1" android:background="@drawable/radio_group_selector" android:button="@null" android:gravity="center" android:text="@string/name_sort_button" /&gt; &lt;/RadioGroup&gt; </code></pre> <p>What my problem is that all the buttons are found, but the radio group always returns null. I want to use that RadioGroup to find out which button has been checked. Doesn't make sense to me that the buttons inside radio group can be found but the RadioGroup itself cant' be?</p>
    singulars
    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.
    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