I made an offline quiz game in which I ask 10 random questions to user. These questions are taken from my firebase db and kept in a arraylist. My program picks a random question from the arraylist each time and display the question. Here is a piece of my code
public void askQuestion(){
Random rnd=new Random();
int index = rnd.nextInt(questionList.size());
Info theQuestion=questionList.get(index);
question.setText(theQuestion.getQuestion());
a.setText(theQuestion.getA());
b.setText(theQuestion.getB());
c.setText(theQuestion.getC());
d.setText(theQuestion.getD());
answer=theQuestion.getAnswer();
}
//Info is the name of the object for my questions. questionList is an arraylist of type info where I keep the all questions I got from firebase.
Here is my problem(s).
- I read that I should use google play services to make a game online. Is there a better approach? What is the best place to start(a link would be appreciated)
- Can I use this activity in my online game or should I change it? Will randomness be same in both users? I want to ask them same questions.