Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8338795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:42:15+00:00 2026-06-09T04:42:15+00:00

quiz_list.xml : My xml file <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=wrap_content android:orientation=vertical> <TextView android:id=@+id/question android:layout_width=fill_parent android:layout_height=wrap_content

  • 0

quiz_list.xml : My xml file

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

  <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" />

  <RadioGroup
        android:id="@+id/radioGroup"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:text="Radio Group"
        >
    <RadioButton 
        android:id="@+id/option1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        />
    <RadioButton 
        android:id="@+id/option2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        />
    <RadioButton
        android:id="@+id/option3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        />
    <RadioButton
        android:id="@+id/option4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        />
    </RadioGroup>


<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" >

<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" />

<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" />

  </LinearLayout>     

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.

This is my code containing the questions as a json.

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);
    }

I’m adding the questions using a customadapter.

How can i change it to make it work ??
Any Ideas ??? Pls let me know…

Thanks Nishit.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T04:42:17+00:00Added an answer on June 9, 2026 at 4:42 am

    try this

    RadioGroup radioGroup;
    RadioButton radioButton1;
    RadioButton radioButton2;
    RadioButton radioButton3;
    
    boolean hack = false;
    
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    
        radioGroup = (RadioGroup) findViewById(R.id.radioGroup);
        radioButton1 = (RadioButton) findViewById(R.id.r1);
        radioButton2 = (RadioButton) findViewById(R.id.r2);
        radioButton3 = (RadioButton) findViewById(R.id.r3);
    
        OnClickListener radioClickListener = new OnClickListener()
        {
    
            public void onClick(View v)
            {
                if (v.getId() == radioGroup.getCheckedRadioButtonId() && hack)
                {
                    radioGroup.clearCheck();
                }
                else
                {
                    hack = true;
                }
            }
        };
    
        OnCheckedChangeListener radioCheckChangeListener = new OnCheckedChangeListener()
        {
    
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
            {
                hack = false;
            }
        };
    
        radioButton1.setOnCheckedChangeListener(radioCheckChangeListener);
        radioButton2.setOnCheckedChangeListener(radioCheckChangeListener);
        radioButton3.setOnCheckedChangeListener(radioCheckChangeListener);
    
        radioButton1.setOnClickListener(radioClickListener);
        radioButton2.setOnClickListener(radioClickListener);
        radioButton3.setOnClickListener(radioClickListener);
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a questions.xml file which has a list of questions for my quiz,
I'm trying to read from an XML file and use that to populate a
I have an xml file that looks something like this <questions> <question> <text>What color
I've got an XML file that contains a list of questions. I'd like to
I'm creating quiz app of sorts for Android. The questions shall be posed in
I have an xml that has nested tags like the following: <?xml version=1.0 encoding=utf-8
I am a new android developer . I have create a quiz application where
I've made a simple android quiz game for android 2.2 (sdk-8). Everything works perfectly
In my web application authorized user has at least 4 facets: http session related
I am developing a simple quiz app on Android. The questions in the quiz

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.