I am creating a quiz application in android.For each question I have set up 4 radio buttons for the user to click. How do i change the text of the radiobutton dynamically for each question? The text for these radio button are stored in a raw text file.
Here you go.
I have set up 4 radio buttons for the user to click.
You must have defined them in radioGroup,right?
Then you can iterate in RadioGroup to set names to RadioButton or you can get RadioButton by index and set name to it.
RadioGroup radioGroup = (RadioGroup)findViewById(R.id.group);
for (int i = 0; i < radioGroup .getChildCount(); i++) {
((RadioButton) radioGroup.getChildAt(i)).setText(String.valueOf(i));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With