My question is similar to this question and since I was unable to find a satifying answer I would like to put up my question explicitly.
I have a custom adapter which takes an array of strings and has to populate the the list (defined in my ListActivity class) with that array. Now, the layout of each row has a text view and and a radiobutton as shown
layout.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:text="@+id/word"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/word"
android:textSize="30px">
</TextView>
<RadioButton
android:id="@+id/selection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4px"
android:layout_marginRight="10px"
android:layout_alignParentRight="true"
android:layout_x="27px"
android:layout_y="8px">
</RadioButton>
Everything is working fine till this point. I am able to render each row with a radiobutton. What I am looking for is a way in which I can group those radiobuttons together to perform a single selection. This is required for an an application I am making in which has a question with four options as answers. Also please tell me whether this is the right approach for this sort of a problem or not. Thanks in advance