I have an Activity that does the following
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);
and the xml is this
<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" >
<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" />
<View
android:layout_width="1dp"
android:layout_height="48dp"
android:background="@drawable/tab_separator" />
<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" />
<View
android:layout_width="1dp"
android:layout_height="48dp"
android:background="#464646" />
<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" />
</RadioGroup>
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?