title: Using a Random Number in a Drawable Path
body: <p>I am using a random number to set my imageButton to a random image.  I am wondering if there is a way to use the random int in the file path for the drawable.  This code gives a run time error for invalid integer but will compile.</p>
  
  <pre><code>Random generator = new Random();
  int chooseFirstPicture = generator.nextInt(2);
  int imagePath1 = Integer.parseInt("R.drawable.image" + chooseFirstPicture);
  btn1.setBackgroundResource(imagePath1);
  </code></pre>