I made a fairly solid quiz game in Android for my class where 10 random questions are picked from an array. The way it's working right now is that the user enters the answer in an EditText field. I'm also happy that I was able to figure out how not to get duplicate questions using a simple shuffle algorithm so every question thrown at the user is unique (I'm actually pretty proud of that).
Ideally wanted to make the game to be multiple choice but I ran out of time and I submitted it as above. But I've been thinking about ways to make the game betters and user friendly and I think the EditText choice is not ideal IMO. So I've been thinking about rewriting it like this:
create an array to hold your answers. and then choose a random number from 0-[array.length] and set that index in the array to the correct answer. ie:
int answers = new int; answers = getRandomAnswer(); answers = getRandomAnswer(); answers = getRandomAnswer(); answers = getRandomAnswer(); int correctIndex = Random.nextInt(0,4); // Maybe off by 1? I didn't compile answers[correctIndex] = correctAnswer;
Now you have an array that contains 3 random answers and 1 correct answer. You'll want to either make sure that getRandomAnswer() method won't return the correct answer to you, or check your array at this point for multiple instances of the correct answer and if they exist remove all but one.
you could populate a RadioGroup with the answers in your array and you know if the user is correct by checking against the correctIndex variable when they select one of the radio buttons in the group.