title: Trying to access imageViews that reside in a TableLayout - Android
body: <p>I have a TableLayout which has 3 TableRows and within the rows there are 3 ImageViews. What I am trying to do is iterate through the table and setImageResource for each ImageView in the table.
  I have tried using this code, but I am getting stuck with this problem. I am a beginner at Android, any help is greatly appreciated, thank you.</p>
  
  <p>My code as follows...</p>
  
  <pre><code>TableLayout tableLayout = (TableLayout) findViewById(R.id.tableLayout);
  TableRow tableRow = (TableRow)tableLayout.getChildAt(0);
  ImageView imageView = (ImageView)tableRow.getChildAt(0);
  
  
  int x = tableLayout.getChildCount();
  for(int i = 0;  i &lt; x; i++){
      tableRow= (TableRow)tableLayout.getChildAt(i);
      for( int j = 0; j &lt; 3; j++){
          imageView = (ImageView)tableRow.getChildAt(j);
          imageView.setImageResource(0);
      }
  }
  </code></pre>