title: Android: Need help fixing loop adding elements in ArrayList
body: <p>Currently I have a two dimensional ArrayList of EditTexts.  Currently if a user enters in a 2x3 matrix (based on what is entered into the EditTexts) such as  </p>
  
  <pre><code>[1 2 3]  
  [4 5 6]
  </code></pre>
  
  <p>my code would create a Two-Dimensional ArrayList like below instead of like above  </p>
  
  <pre><code>[1 2 3 4 5 6]  
  [1 2 3 4 5 6]
  </code></pre>
  
  <p>How do I get my code to produce an array like the first one instead of what it currently is producing?</p>
  
  <p>My code:</p>
  
  <pre><code>public class Game extends Activity implements OnClickListener {    
     private static final String TAG = "Matrix";
      static ArrayList&lt;EditText&gt; columnEditTexts;
      static ArrayList&lt;ArrayList&lt;EditText&gt;&gt; arrayOfEditTexts = new ArrayList&lt;ArrayList&lt;EditText&gt;&gt;();
  
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         this.setContentView(R.layout.matrix);
         View doneButton = findViewById(R.id.done_button);
         doneButton.setOnClickListener(this);
         columnEditTexts = new ArrayList&lt;EditText&gt;();
  
         for(int i = 0; i &lt; MatrixMultiply.h1; i++){
             TableLayout table = (TableLayout)findViewById(R.id.myTableLayout);
             TableRow row = new TableRow(this);
             EditText column = new EditText(this);
             for(int j = 0; j &lt; MatrixMultiply.w1; j++){
                 table = (TableLayout)findViewById(R.id.myTableLayout);
                 column = new EditText(this);
                 column.setId(i);
                 row.addView(column);
                 columnEditTexts.add(column);
             }
             table.addView(row);
             arrayOfEditTexts.add(columnEditTexts);
         }
  
     }
  </code></pre>