Beginning Android Programming - Building a short Quiz
<p>Okay, so I'm writing my first Android app and am basically stuck. The app is a short 4 question quiz with two choices per question. This creates 16 possible results, which I've created descriptions for. I want the app to display the description corresponding to the user's responses on each of the questions after the 4th question is answered. </p>

<p>Right now I am storing the values in a string, which is supposed to build upon the previous string answer, after each question. So the first answer is t1, the second answer is t2, and so on. Here is the code for the second question:</p>

<pre><code>public class Question2 extends Question1 implements OnClickListener
{
 private Button b1;
 private Button b2;
 public String t2;
 public TextView text2;

 @Override
 public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.question2);
 b1=(Button)findViewById(R.id.gamma);
 b2=(Button)findViewById(R.id.delta);
 b1.setOnClickListener(this);
 b2.setOnClickListener(this);
 text2 = (TextView)findViewById(R.id.TextView02);
 }


 public void onClick(View v) {
  Intent a = new Intent(this, Question3.class);
 if(v == b1)
 { 
  t2= t1+"gamma";
  text2.setText(t2);
 startActivity(a);
 }
  if(v == b2)
 {
 t2= t1+"delta";
 text2.setText(t2);
 startActivity(a);
 }

}
}
</code></pre>

<p>My problem is that the strings won't hold the values I assign them in the previous question. I have a textview that briefly displays the values returned by the question's answer string (t2 for Question2) and it displays nullalpha or nullbeta, depending on the user's response. </p>

<p>How do I retain the t1's previously assigned value into Question2 so I can add to it? For instance, if t1 = "alpha" from Question1, and the user selects button b1 in Question2 how do I make t2 actually equal "alphagamma" instead of "nullgamma"? Is this even possible with strings?</p>

<p>Any answers and suggestions are much appreciated.</p>
