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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:51:31+00:00 2026-06-03T03:51:31+00:00

I have a radio button group in Android. I receive events when the items

  • 0

I have a radio button group in Android.
I receive events when the items are selected. Normal so far.
But I don’t get the event if the user clicks on an already selected item.
Is there a way to know (to receive an event) when the users hits a radiobutton either if it is selected or not?
Thanks a lot.

  • 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-03T03:51:31+00:00Added an answer on June 3, 2026 at 3:51 am

    i don’t understand why you would get an event when clicked on an already checked radio button,
    but if you want to unselect a radio button by a click on it if it is already selected!!
    check this code it can help you:

    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.rg);
        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)
            {       //The first codition check if we have clicked on an already selected radioButton
                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);
    
    } 
    Hope this wil help
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 radio button with 2 group. The structure is like this Main
I have a group of three radio buttons. Depending on which radio button is
I have a radio button group like this : <g:radioGroup name=myGroup values=[1,2,3] value=1 >
I have a radio group with two radiobuttons. each button has a custom selector.
We have a form with a radio button group, where any one of the
I have some stray text next to radio buttons in a radio button group.
this may be a weird question but I have several radio button groups with
I have 3 different radio button group in jQuery like so: <tr class=toValidate> <td>Please
I have a radio button group on a survey form whose html looks like:
So I have a Radio button group, like so: <div data-role=fieldcontain> <fieldset data-role=controlgroup> <legend>Choose

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.