title: Android initialize toggle buttons with tags
body: <p>In my program I have multiple togglebuttons and I need to initialize them with tags instead of id's in the for loop like:</p>
  
  <pre><code>for(int i = 0 ; i&lt; Grid.GRID_SIZE*Grid.GRID_SIZE ; i++){
          toggleButtons[i] = (ToggleButton)table.findViewWithTag(i);
  }
  </code></pre>
  
  <p>And I want to paint them black like:</p>
  
  <pre><code>for(int i = 0 ; i&lt; Grid.GRID_SIZE*Grid.GRID_SIZE ; i++){
          toggleButtons[i].setBackgroundColor(Color.BLACK);
  </code></pre>
  
  <p>}</p>
  
  <p>But it gives nullpointer exception becasue of I initialized them with tags, any suggestions?</p>