Note that there are some explanatory texts on larger screens.

plurals
  1. PORadio Button is selected automatically in android
    primarykey
    data
    text
    <p>quiz_list.xml : My xml file</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical"&gt; &lt;TextView android:id="@+id/question" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#43bd00" android:textSize="20sp" android:textStyle="bold" android:paddingTop="4dip" android:paddingBottom="1dip" /&gt; &lt;RadioGroup android:id="@+id/radioGroup" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="Radio Group" &gt; &lt;RadioButton android:id="@+id/option1" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;RadioButton android:id="@+id/option2" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;RadioButton android:id="@+id/option3" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;RadioButton android:id="@+id/option4" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;/RadioGroup&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginLeft="5dp" android:gravity="bottom|center_horizontal" android:orientation="horizontal" &gt; &lt;Button android:id="@+id/loadPrevious" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5dp" android:layout_marginTop="10dp" android:text="Load Previous" android:visibility="invisible" /&gt; &lt;Button android:id="@+id/loadNext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5dp" android:layout_marginTop="10dp" android:text="Load Next" /&gt; &lt;/LinearLayout&gt; </code></pre> <p></p> <p>I have a list of questions and radio buttons have the options for it. The problems that I face are 1. When i load the next list a button is already selected. 2. When i load the previous list a different button is selected instead of the one i selected. </p> <p>This is my code containing the questions as a json.</p> <pre><code>String json = "[{\"question\": \"What?\", \"option1\": \"alpha\" , \"option2\": \"beta\" , \"option3\": \"gamma\" , \"option4\": \"alpha\"},{\"question\": \"What is your name ?\", \"option1\": \"Dinesh\" , \"option2\": \"Boopesh\" , \"option3\": \"Srinath\" , \"option4\": \"JK\"},{\"question\": \"What is the capital of India?\", \"option1\": \"Delhi\" , \"option2\": \"Bombay\" , \"option3\": \"Calcutta\" , \"option4\": \"Chennai\"}]"; Gson gson = new Gson(); JsonParser parser = new JsonParser(); JsonArray array = parser.parse(json).getAsJsonArray(); for(JsonElement obj : array) { Quiz quiz = gson.fromJson(obj,Quiz.class); String question = quiz.getQuestion(); System.out.println("Question: "+question); quizList.add(quiz); } </code></pre> <p>I'm adding the questions using a customadapter.</p> <p>How can i change it to make it work ?? Any Ideas ??? Pls let me know... </p> <p>Thanks Nishit. </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.
 

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