I am working on a Single choice and Multiple choice test.
I have couple of questions and 4 answers for each question.
I am shuffling the answers as each answer is assigned to radio button.
This is how i am shuffling the arraylist where Random is a arraylist with items and r1,r2,r3,r4 are radio buttons.
random.add(val);
Collections.shuffle(random);
r1.setText(random.get(0));
r2.setText(random.get(1));
r3.setText(random.get(2));
r4.setText(random.get(3));
I am able to display the answers in jumbled way but when i select the answer i need to show that the answer is correct or wrong.
Sample question and options.
1. which language is used for android programming?
A.PHP
B.JAVA
C.C
D.C++
Correct answer is B i need to display that correct answer is B.
How to acheive this.
EDIT:
I have tried this:
Onclick of each radio button assign the value A and compare the value with xml value if its correct display correct but when i jumble its will not work.
EDIT 2
xml
<Question no="1" text="Which Programming language is used in android develoment" type="SCA" noc="4" jumble="NO" correctans="PHP">
<choice a = "PHP" flag="A">
<choice b = "JAVA" flag="B">
<choice c = "C" flag="C">
<choice d = "C++" flag="D">
Here is a somewhat naive solution but it should work.
Shuffle the keys of the Map in your Question object
In your radio buttons, do something like
r1.setText(random.get(0))On click, do