JCMcRae
JCMcRae

Reputation: 257

Make TextView and EditText appear when selecting a Radio button?

So, on this app I am making, I have a radio group set up, and what I want to do is make a Textview and an EditText appear under the radio group when it when one of the radio buttons are selected. How would I go about making that happen?

Thank you for your time.

Upvotes: 0

Views: 68

Answers (1)

Wand Maker
Wand Maker

Reputation: 18762

Use setOnCheckedChangeListener method

radioButton.setOnCheckedChangeListener(new OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    if (isChecked) {
                        //make TextView & Edit Text visible
                    } else {
                        //Hide the TextView and EditText
                    }
                }
            });

Upvotes: 1

Related Questions