title: Android/Java "Convert" String to Button
body: <p>I have this code:</p>
  
  <pre><code>Button button1 = (Button) findViewById(R.id.button1);
  Button button2 = (Button) findViewById(R.id.button2);
  
  String object = "button";
  int num;
  num = r.nextInt(3 - 1) + 1;
  String total = object + num;
  </code></pre>
  
  <p>I want do set the text for one of the buttons chosen randomly. Something like this:</p>
  
  <pre><code>button&lt;num&gt;.setText(some_text);
        ^ here instead of &lt;num&gt; should be 1 or 2
          and has to be chosen randomly
  </code></pre>