title: Show Multiple ImageViews Dynamically in Relative Layout Android
body: <p>I am working in An Android App
  in which 
  Relative layout is</p>
  
  <pre><code>  &lt;ImageView
      android:id="@+id/imageView1"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:layout_marginTop="2dp"
      android:adjustViewBounds="true"
      android:background="@drawable/background" /&gt;
  &lt;RelativeLayout
      android:id="@+id/mymainlayout"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
      &gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>my problem is I am unable to Draw all ImageViews programatically in this Relative Layout it is showing only one image.
  Here is my code</p>
  
  <pre><code>    for (int i = 0; i &lt; realAnswer; i++) {
  
          arrayofImages[i] = new ImageView(this);
          arrayofImages[i].setImageResource(imageId[imageNumber]);
          arrayofImages[i].setId(i);
          if(i!=0)
          {
          RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
          params.addRule(RelativeLayout.LEFT_OF,  arrayofImages[i-1].getId());
          //arrayofImages[i].setLayoutParams(params);
          nn.addView(arrayofImages[i],params);
          }
      else
          {
              nn.addView(arrayofImages[i]);
          }
  
      }
  </code></pre>
  
  <p>here nn is my main layout</p>
  
  <p>any help Please   ???</p>