title: Programmatically adding items from a list to a TableLayout
body: <p>I have an Android project I am working on.  I am fairly new to Android Development so I have some code in a MainActivity.java file that I am working on Creating a Table Layout for but the way my code currently is I can only add one item from that list what can I do in the Activity.java class to change this so it will programmatically add all of my Mcdonalds objects too the Table.  What can I do to add both rows to the view on MainActivity.java?</p>
  
  <p>Activity_Main.xml</p>
  
  <pre><code> &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     
       xmlns:tools="http://schemas.android.com/tools"
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:paddingBottom="@dimen/activity_vertical_margin"
       android:paddingLeft="@dimen/activity_horizontal_margin"
       android:paddingRight="@dimen/activity_horizontal_margin"
       android:paddingTop="@dimen/activity_vertical_margin"
       tools:context=".ShelterActivity" &gt;
  
   &lt;TableLayout android:id="@+id/TableLayout01" android:layout_width="fill_parent" android:layout_height="wrap_content"  android:stretchColumns="0"&gt;
  
     &lt;TableRow 
         android:id="@+id/TableRow01" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content"&gt;
  
       &lt;TextView 
           android:id="@+id/TextView01" 
           android:layout_width="wrap_content" 
           android:layout_height="wrap_content" 
           android:text="Address"
           android:width="250px"
           android:textStyle="bold"&gt;&lt;/TextView&gt;
       &lt;TextView 
           android:id="@+id/TextView02" 
           android:layout_width="wrap_content" 
           android:layout_height="wrap_content" 
           android:text="Distance"
           android:width="250px"
           android:textStyle="bold"&gt;&lt;/TextView&gt;
       &lt;TextView 
           android:id="@+id/TextView03" 
           android:layout_width="wrap_content" 
           android:layout_height="wrap_content" 
           android:text="ETA"
           android:width="250px"
           android:textStyle="bold"&gt;&lt;/TextView&gt; 
     &lt;/TableRow&gt;
   &lt;/TableLayout&gt;  
   &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>MainActivity.java</p>
  
  <pre><code>         protected void onCreate(Bundle savedInstanceState) {
               super.onCreate(savedInstanceState);
           setContentView(R.layout.activity_shelter);
           List&lt;McDonalds&gt; mcdList = new ArrayList&lt;McDonalds&gt;();
  
                 ScrollView sv = new ScrollView(this);
  
                       // get a reference for the TableLayout
                       TableLayout ll = (TableLayout) findViewById(R.id.TableLayout01);
  
                       HorizontalScrollView hsv = new HorizontalScrollView(this);
                 // create a new TableRow
                       TableRow row = new TableRow(this);
  
  
           //This will be replaced by a Read Only Stored procedure that gets the List of Shelters
           McDonalds mcdonalds = new McDonalds("720 N Main St, Roswell, NM", 1.08, 8.0);
           mcdList.add(mcdonalds);
           McDonalds mcdonalds1 = new McDonalds("1804 S Main St, Roswell, NM", 2.9, 12.0);
           mcdList.add(mcdonalds1);
           for (McDonalds mcD : mcdList){
                // create a new TextView
                      TextView t = new TextView(this);
                      TextView t1 = new TextView(this);
                      TextView t2 = new TextView(this);
          String mcdAddress = mcD.getAddress();
          String distance = mcD.getDistance().toString();
          String ETA = mcD.getETA().toString();
          t.setText(mcdAddress);
          t1.setText(distance);
          t2.setText(ETA);
          row.addView(t);
          row.addView(t1);
          row.addView(t2);
  
  
      }
      // add the TableRow to the TableLayout
      ll.addView(row,new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
  
  }
  </code></pre>
  
  <p>As seen in the code above there should be two items in the list and I need a way to add both items with the <code>ll.addView(row,new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));</code> but this will throw a error.</p>