Write a function that implements a random function algorithm (you can write your own or find one on the internet - they are very common and simple).
Then, programmatically add the RadioButton
s to the RadioGroup
using addView() to render them. Use the results of your random function to determine the "index" parameter of the addView() function.
Your random function would ensure that each time the radio buttons are rendered, their order remains random.
UPDATE
To make things clearer, suppose your random function returns the following order :-
2
1
4
3
Now, what you need to do is to call addView()
four times with "index" parameter taking up the above values in order.
Ex :-
addView(radioButton2);
addView(radioButton1);
addView(radioButton4);
addView(radioButton3);