Jerome
Jerome

Reputation: 79

How to randomize layout in android

I have a quiz game that has an activity which has a flow like this:

Q=question

start button intent> Q1 intent> Q2 intent> Q3 intent> Q4 intent> Q5

How can I randomize the questions? so that every time the user plays again, it will not be Q1 will appear first. and after all the 5 questions appear randomly, it will intent to a specific page, lets say after all 5 questions are randomly displayed it will intent back to main page.

Upvotes: 0

Views: 88

Answers (1)

Timmetje
Timmetje

Reputation: 7694

You should just create 1 question Intent which loads your questions dynamically.

So make a Questions.class which contains a simple list with all questions, and in the onCreate() method. Randomize which question you load in your layout.

Please read the Android developers guide.

Upvotes: 1

Related Questions