android go back button
<p>I want to build a "quotes app" so every time the user clicks on the button a random quote appears. But I also want to set an button, which takes the user back to the quote he saw before. And because it always picks a quote randomly I wanted to store the int number of the quote, so every time someone clicks the button it stores in a int string which quote has been shown. But I get errors all the time. can someone give me an sample code for such a back-button? thanks (button2 should be bak button)</p>

<p>final int[] Random2 = {};</p>

<pre><code>    button1.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            // TODO Auto-generated method stub
             Zufallszahl1 = Würfel.nextInt(98);

             Random2[counter] = Zufallszahl1;
            counter++;


                text1.setText(Lines[Zufallszahl1]

            );

        }

    });


    button2.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            // TODO Auto-generated method stub

            text1.setText(Lines[Random2[counter-1]]);
        }
    });



}
</code></pre>

<p>}</p>
