title: Setting an ImageView from a For-Loop
body: <p>This question may be a bit a tricky.  I tried, but I am not really even sure what to search for, so I did not find any documentation on this.</p>
  
  <p>I have a 7x10 grid, and each grid has its own image view.  The ImageViews for the grids are named grid00, grid01, ..., grid79, grid710.  I want to change the image for each grid in a nested for loop. so where it says in my code:</p>
  
  <pre><code>grid04.setImageResource(R.drawable.walllr);
  </code></pre>
  
  <p>What I realy want it to do is:</p>
  
  <pre><code>gridij.setImageResource(R.drawable.walllr);
  </code></pre>
  
  <p>where <em>i</em> and <em>j</em> after the word grid are the <em>i</em> and <em>j</em> from the nested for loop.</p>
  
  <p>I am trying to change the image for all 70 items without writing code for each of the 70 items.  Is this possible?  Here is the code:</p>
  
  <pre><code>public void initialize() {
      map = DM.getMap();
      for (int i = 0; i &lt; 7; i++) {
          for (int j = 0; j &lt; 10; j++) {
              if (map[i][j].isUsed()) {
                  grid04.setImageResource(R.drawable.walllr);
              }
          }
      }
  }
  </code></pre>