-
Replacing images with text when a radio button is clicked.
about 9 years ago
-
about 9 years ago
First you need to implement onCheckedChange listener on the radio group from which you can identify which radio button is clicked. Implement listener like this:-
RadioGroup radioGroup = (RadioGroup) findViewById(R.id.yourRadioGroup); radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { // checkedId is the RadioButton selected } });
Now you know which radio button is checked or selected. After this simply hide the image and show the test using setVisibility method of View class.
1 Answer(s)