title: If Statement for Android TextView Message Display
body: <p>How do I create an <code>if</code> statement for the Android <code>setText()</code> command?</p>
  
  <p>For example, if I have something like:</p>
  
  <pre><code>Button button = (Button) findViewById(R.id.button);
  TextView messageBox = (TextView)findViewById(R.id.message);
  phrase[0] = "Hello World!";  //
  phrase[1] = "Toast";         // array is declared earlier in code
  Random r = new Random();
  int  n = r.nextInt(1);
  messageBox.setText(phrase[n]);
  
  if(/*condition when phrase[1] is displayed in messageBox*/){
     // do stuff
  }
  </code></pre>
  
  <p>The idea is that I want to structure an <code>if</code> statement that monitors when a certain message is displayed in my <code>messageBox</code> object.</p>