Generate Random integers upon Button Click without refreshing activity
<p>Hey everyone :) Ive been scratching my head on this one, and can't seem to find an appropriate answer that works even though I'm sure its a simple issue. </p>

<p>I have a program which generates a random letter text on a group of buttons when another button being pressed. 
When I open the application it loads fine and the first time the button is pressed it generates correctly, but after that I can't seem to get it to regenerate random letters. </p>

<p>I can accomplish what I want by adding an Intent, and essentially "refreshing" (not sure of the wording) the main activity but I would like to add a counter for the button clicks, and it resets when the activity does.</p>

<pre><code>    {Intent intent = new Intent(MainActivity.this,     MainActivity.class);
    startActivity(intent);
        finish();
        overridePendingTransition(0, 0);
</code></pre>

<p>I just cant seem to wrap my mind around how to do it otherwise. It's seems like I need to rerun the java every time the button is clicked. Any suggestions?</p>

<p>Here is some code, I used buttons rather than textview because I a)wanted to set an easy background b)may make them clickable later. Thanks so much in advance!</p>

<pre><code>public class MainActivity extends Activity 
{

    Button spin;
    Button reel1,reel2,reel3,reel4;
    private String rnd,rnd2,rnd3,rnd4;

    int count1=50;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        addListenerOnButton();}


    private static String rndm[]  = {"A","B","C","D"};
    {rnd = rndm[(int) (Math.random() * rndm.length)];}
    private static String rndm2[]  = {"A","B","C","D"};
    {rnd2 = rndm2[(int) (Math.random() * rndm2.length)];}
    private static String rndm3[]  = {"A","B","C","D"};
    {rnd3 = rndm3[(int) (Math.random() * rndm3.length)];}
    private static String rndm4[]  = {"A","B","C","D"};
    {rnd4 = rndm4[(int) (Math.random() * rndm4.length)];}

    public void perform_action(View v){}

    public void addListenerOnButton() {


        spin = (Button) findViewById(R.id.spin);
        spin.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {

                    {Toast.makeText(getApplicationContext(),"button pressed",     Toast.LENGTH_SHORT).show();}


                {Button tv = (Button)     findViewById(R.id.reel1);
                    tv.setText(String.valueOf(rnd));
                    tv.setTextColor(Color.parseColor("#000000"));}

                {Button tv = (Button)     findViewById(R.id.reel2);
                    tv.setText(String.valueOf(rnd2));
                    tv.setTextColor(Color.parseColor("#000000"));}

                {Button tv = (Button)     findViewById(R.id.reel3);
                    tv.setText(String.valueOf(rnd3));
                    tv.setTextColor(Color.parseColor("#000000"));}

                {Button tv = (Button)     findViewById(R.id.reel4);
                    tv.setText(String.valueOf(rnd4));
                    tv.setTextColor(Color.parseColor("#000000"));
</code></pre>