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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:00:45+00:00 2026-05-28T20:00:45+00:00

I have sucessfully made and used RadioGroup’s before in xml, but each time there

  • 0

I have sucessfully made and used RadioGroup’s before in xml, but each time there was a set of radio buttons in succession, all within the same LinearLayout. Now I wish to define a set of radio buttons to be part of a group, but they are not in the same layout. My start and end code for the group is:

START:

<RadioGroup    android:id="@+id/radioGroup1" >

END:

</RadioGroup>

If I place this around each button individually, then it compiles, but the buttons don’t act as radio buttons (i.e. activating one did not de-activate the others). If I try to place the “start” before any of the buttons and put the “end” after the last of them, then I get compilation errors.

  • 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-28T20:00:46+00:00Added an answer on May 28, 2026 at 8:00 pm

    Store the RadioButtons in an array. Instead of grouping them in a RadioGroup, you have to enable/disable them yourself. (un-tested so no copying/pasting )

    declare these variables

    private ArrayList<RadioButton> mGroup = new ArrayList<RadioGroup>();
    private CompoundButton.OnCheckedChangeListener mListener = new CompoundButton.OnCheckedChangeListener()
    {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
        {
            for(RadioButton btn : mGroup)
                btn.setChecked(false);
    
            buttonView.setChecked(true);
        }
    }
    

    Somewhere in your activity:

    mGroup.add(your radiobuttons);    // e.g. (RadioButton)findViewById(R.id.radio_button1);
    mGroup.add(another radiobutton);
    
    for(RadioButton btn : mGroup)
       btn.setOnCheckedChangeListener(mListener)
    

    Maybe you have to invalidate your Buttons after checking/unchecking them, to cause a redraw

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a mvc view made up of a matrix of radio buttons. Each
I have made the following animation in my android project <?xml version=1.0 encoding=utf-8?> <set
HI I have made a maintenance package in that have used shrink database task
I have successfully made an facebook application which shows real time data from facebook
I am sure this has been asked before, but I have yet to find
I have PKCS#12 keystore that I've sucessfully imported in my browser for accessing a
I have successfully used the Excel and Word addin templates in Visual studio 2008
I have successfully set up FILESTREAM on my SQL 2008 server; however I've noticed
I have a web application which uses membership and profiles. I successfully used the
I have used unixodbc and FreeTDS for connecting to SQL Server from linux. Connection

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.