How to Loop over ten questions
<p>I'm in the process of creating a simple maths game. I'm trying to create a loop that will display ten questions, one at a time, to a textview. The user will enter the answer into an edittext, press a button, and then question will be validated and the next question in the series of ten will appear in the textview.</p>

<p>I'm just not quite sure how to get to the next question. Any help will be greatly appreciated.</p>

<p>Here's what I've done so far:</p>

<pre><code>int x = 0;

while (x &lt; 10) {
  if (i1 == 1) {
    answer = q1;
    editTextEquation.setText(random1 + "+" + random2);
    x++;
  }
  if (i1 == 2) {
    answer = q2;
    editTextEquation.setText(random1 + "-" + random2);
    x++;
  }
  if (i1 == 3) {
    answer = q3;
    editTextEquation.setText(random1 + "/" + random2);
    x++;
  }
  if (i1 == 4) {
    answer = q4;
    editTextEquation.setText(random1 + "*" + random2);
    x++;
  }
}
</code></pre>

<p>and then the validation button calls this method</p>

<pre><code>private void questions() {
  int score = 0;
  int i = Integer.parseInt(editText.getText().toString());
  if (i == answer) {
    editText.setText("Correct");
    score++;
  } else {
    editText.setText("Incorrect");
  }
}
</code></pre>
