title: Can not create array of buttons programatically without an error
body: <p>This block of code does not work for me. I debugged and I think the error is coming from the setlayoutparams but it doesn't make sense because if I take out the for loop and create just 1 button (not an array of buttons) then it'll work.</p>
  
  <pre><code>   Button btn[] = new Button[oNumber];
      for (int i=0;i&lt;oNumber;i++){
          btn[i].setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT));
          btn[i].setText(oName[i]);
          System.out.println("making b's");
          layout.addView(btn[i]);
      }
  </code></pre>
  
  <p>This is the error I get. I do have the activity correctly written in the manifest.</p>
  
  <pre><code>    08-14 12:45:56.482: E/AndroidRuntime(4060): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.rcontrol/com.example.rcontrol.ViewTarget}: java.lang.NullPointerException
  </code></pre>