title: Android: random and textView
body: <p>I have just started learning Android and got some misunderstanding. I'm trying to create an application which displays a textView and a button. Every button click generates a new random number which should be displayed in the textView.</p>
  
  <p>But unfortunately my code causes a list of errors. Here it is:</p>
  
  <pre><code>public class FirstAndroidProjectActivity extends Activity {
  
  public OnClickListener listener = new View.OnClickListener() {
  
      @Override
      public void onClick(View v) {
          TextView tv = (TextView) findViewById(R.id.display);
          Random r = new Random();
          int i = r.nextInt(101);
           tv.setText(i);
  
      }
  };
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
     Button button = (Button) findViewById(R.id.button);
     button.setOnClickListener(listener);    
      }
  }
  </code></pre>
  
  <p>If I just don't use random and use some string except of <strong>i</strong> 
  (for example <strong>tv.setText("99");</strong>) everything is ok, but it doesn't work with a variable as a parameter of setText().</p>
  
  <p>Where is a mistake?</p>
  
  <p>Hope for your help.</p>