How to set On click listener on the Radio Button in android

I have two radio button inside the radio group now I want to set On click listener on that radio button. When One radio button is clicked Edit Text text has to change when I click on the Other Radio button text of the same edit Text has changed.

Answers


I'd think a better way is to use RadioGroup and set the listener on this to change and update the View accordingly (saves you having 2 or 3 or 4 etc listeners).

    RadioGroup radioGroup = (RadioGroup) findViewById(R.id.yourRadioGroup);        
    radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() 
    {
        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            // checkedId is the RadioButton selected
        }
    });

Need Your Help

Network response too late?

java android string

i have a registration function that registers a user in my app.

How can I find the position of an object in a two-dimensional array?

position jlabel dimensional

So to be specific i have a two-dimensional array filled with JLabels. If from another method i get one JLabel that we know for sure that exists in that array how can i get the coordinates of the la...

Centering uneven rows within a centered table

html css

I am attempting to center a table and its rows in CSS.