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 7499471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:50:10+00:00 2026-05-29T19:50:10+00:00

I am having a problem with a radio button that is in a radio

  • 0

I am having a problem with a radio button that is in a radio group.

I have an app that is a quiz application and I ask 5 questions.

When run the application in my Android emulator all the questions have no problem but only on the 3rd question. When I click with my mouse on the radio button it seems toggle to a checked state but then it unchecks right away. Has anyone seen this kind of behavior?!

I setup this Radio group and dynamically add 4 radio buttons in a radio group and then use an OnCheckedChangeListener() event to capture the change.

radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                // TODO Auto-generated method stub
                for(int i=0; i<=3;i++)
                {
                    RadioButton btn = (RadioButton) radioGroup.getChildAt(i);

                    if (btn.isPressed() && questNo < 6)
                    {

                        if (corrAns[questNo-1].equals(btn.getText()) && flag==true)
                        {
                            Log.e(LOG_TAG,"onCheckedChanged: correct answer = btn Text");
                            score++;
                            flag = false;
                            checked = true; 
                        }
                        else if(checked==true)
                        {
                            Log.e(LOG_TAG,"onCheckedChanged: correct answer != btn Text");
                            score--;
                            flag = true;
                            checked=false;
                        }
                    }
                }

                Log.e(LOG_TAG, "Score:"+ Integer.toString(score));
            }
        });

I have noticed that it happens randomly on different questions and only on first radiobutton that is selected but if you select another one after then the functionality returns to normal. Any ideas?

  • 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-05-29T19:50:11+00:00Added an answer on May 29, 2026 at 7:50 pm

    I had the same bug. I’m also using dynamic radioGroups and buttons. This is working for me:

    private OnCheckedChangeListener rblLikert_Listener = new OnCheckedChangeListener() {
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            int selectedIndex = group.getCheckedRadioButtonId();
    
            if(selectedIndex != -1)
            {
                m_likertValue = radioButtonValue;
                int buttonId = group.getCheckedRadioButtonId();
                Logger.i("button id: " + String.valueOf(buttonId));
                RadioButton selectedButton = (RadioButton)findViewById(buttonId);
                selectedButton.toggle();
                Logger.i(" is checked: " + String.valueOf(selectedButton.isChecked()));
            }
        }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

am having problem, my app doesn't seem to check the radio button based from
I'm having a problem with nested model forms that contain radio buttons, when I
Ok I have made a simple radio app that streams music from my university
I'm having a real problem with retrieving the value of a radio button using
I have a group of radio buttons that I'm trying to validate with a
I have included my two code sources below. The problem that I am having
I have a little problem that i'm creating a simple search application which have
I'm having problem when running my Windows Forms program. In the program, I have
i'm having problem to deal with charset in ruby on rails app, specificially in
I am having problem that when i am trying to submit the form by

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.