title: random genaration of image from drawable folder in android
body: <p>Android version:4.2<br>
  I am developing an android App. I need to generate images from drawable folder randomly. In my drawable I have 45 images with different names.
  My xml code is:</p>
  
  <pre><code>&lt;ImageView
  android:id="@+id/imageView1"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  /&gt;
  </code></pre>
  
  <p>I have tried with this code:</p>
  
  <pre><code>ImageView img=(ImageView)findViewById(R.id.imageView1);
  Random rand = new Random();
  int rndInt = rand.nextInt(52) + 1;
  String drawableName = "photo"+ rndInt;
  
  int resID = getResources().getIdentifier(drawableName, "drawable",  getPackageName());
  img.setImageResource(resID);
  </code></pre>
  
  <p>But with this code I need to change my image names to <code>photo1</code>, <code>photo2</code>, ... and I don't want to do it.</p>
  
  <p>Any suggestion on how to implement it? Thank you.</p>