title: Random text on button click
body: <p>I have around 150 different texts that I want to be shown in random order when I press a <code>Button</code>. A new one every time I press the <code>Button</code>. I have figured out this code:</p>
  
  <pre><code>   Random myRandom = new Random();
     TextView textblondin = (TextView) findViewById(R.id.textblondin);
     switch(myRandom.nextInt() %3) {
        case 0:
           textblondin.setText("Text 1");
           break;
        case 1:
           textblondin.setText("Text 2");
           break;
        case 2:
       textblondin.setText("Text 3");
       break;
        default:
       break;
     }
  }
  }   
  </code></pre>
  
  <p>I can get it to linked to a <code>Button</code>. Anyone know how to do this?</p>
  
  <pre><code>public class Blondinskamt extends Activity {           &lt;----X
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      super.onCreate(savedInstanceState);
      setContentView(R.layout.blondintext);
      View myRandom = findViewById(R.id.myRandom);
      myRandom.setOnClickListener(null);
  
  
      myRandom.setOnClickListener(new View.OnClickListener() {
      Random myRandom = new Random();
      TextView textblondin = (TextView) findViewById(R.id.textblondin);    &lt;----X
      switch(myRandom.nextInt() %3) {
      case 0:
          textblondin.setText("Skämt");
          break;
      case 1:
          textblondin.setText("Roligt");
          break;
      case 2:
          textblondin.setText("kul kul kul kul");
          break;
        default:
  </code></pre>
  
  <p>}
  }</p>
  
  <p>I Still get errors where i put the "&lt;----X" what am i doing wrong? </p>