title: How can we use a variable in R.id
body: <p>The content of xml are </p>
  
  <pre><code>&lt;AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/MainFrame"
  android:layout_width="match_parent"
  android:layout_height="match_parent" &gt;
  
  &lt;AbsoluteLayout
      android:id="@+id/AbsoluteLayout1"
      android:layout_width="match_parent"
      android:layout_height="172dp"
      android:layout_x="12dp"
      android:layout_y="26dp"
      android:visibility="invisible" &gt;
  
  &lt;/AbsoluteLayout&gt;
  
    &lt;AbsoluteLayout
      android:id="@+id/AbsoluteLayout2"
      android:layout_width="match_parent"
      android:layout_height="172dp"
      android:layout_x="20dp"
      android:layout_y="184dp" android:visibility="invisible"&gt;
  
  &lt;/AbsoluteLayout&gt;
  
  &lt;/AbsoluteLayout&gt;
  </code></pre>
  
  <p>Here's the main code</p>
  
  <pre><code>String layoutid;
  int ctr = 1;
  AbsoluteLayout [] mainlayout = new AbsoluteLayout[12];
  
     while (ctr&lt;3)
     {
          layoutid = "AbsoluteLayout" + ctr;
          mainlayout[ctr] = (AbsoluteLayout)findViewById(R.id.layoutid);
          ctr++;
     }
  </code></pre>
  
  <p>We need to make a loop to make</p>
  
  <pre><code> ctr = 1 
   AbsoluteLayout + ctr = AbsoluteLayout1 
   ctr++; 
  
   AbsoluteLayout + ctr = AbsoluteLayout2
  </code></pre>
  
  <p>we want to declare the AbsoluteLayout1 and AbsouluteLayout2 but it doesn't work. We know that the R.id.layoutid is the culprit. So how can we resolve it?</p>