title: Set TableLayout programmatically to content_main.xml
body: <p>I am new in android developing and have my problems by develop my <code>UI</code> what looks easy but doesn't work. I have a method for my App which should built me a new <code>UI</code>.</p>
  
  <p>It should create a <code>tableLayout</code> with <em>x table rows</em>. I don't know before how many that are so I do it in Code. But I see nothing and get no Errors/Warnings.</p>
  
  <p>Here my Code from <strong><em>MainActivity.java</em></strong>:</p>
  
  <pre><code>private void buildNewUI(PatientRepository repoPatient, ExternalSystemsRepository repoExtSys){
  
      TableLayout tableLayout = new TableLayout(this);
      tableLayout.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT));
      tableLayout.setStretchAllColumns(true);
  
      Iterator patIterator = repoPatient.getIterator();
  
      while(patIterator.hasNext()){
          TableRow row = new TableRow(this);
          Patient patient = (Patient) patIterator.next();
          TextView outputLeft = new TextView(this);
          outputLeft.setText(patient.getSurname());
          row.addView(outputLeft);
          tableLayout.addView(row);
      }
  
  }
  </code></pre>
  
  <p><strong>Activity_main.xml:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:fitsSystemWindows="true"
      tools:context="com.patientfinder.MainActivity"&gt;
  
      &lt;android.support.design.widget.AppBarLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:theme="@style/AppTheme.AppBarOverlay"&gt;
  
          &lt;android.support.v7.widget.Toolbar
              android:id="@+id/toolbar"
              android:layout_width="match_parent"
              android:layout_height="?attr/actionBarSize"
              android:background="?attr/colorPrimary"
              app:popupTheme="@style/AppTheme.PopupOverlay" /&gt;
  
      &lt;/android.support.design.widget.AppBarLayout&gt;
  
      &lt;include layout="@layout/content_main" /&gt;
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  
  
  and content_main.xml:
  
      &lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      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"
      app:layout_behavior="@string/appbar_scrolling_view_behavior"
      tools:context="com.patientfinder.MainActivity"
      tools:showIn="@layout/activity_main"&gt;
  &lt;/TableLayout&gt;
  </code></pre>
  
  <p>What is my mistake?</p>