title: How to insert data in TableLayout from .java file?
body: <p>I've a <code>TableLayout</code> in my android application. I'm new to <code>TableLayout's</code> so I dont know how to insert the data in all the rows from my .java file.<br>
  This is my xml file containing the <code>TableLayout</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"&gt;
              &lt;TableRow android:id="@+id/tabla_cabecera" android:layout_width="match_parent" android:layout_height="match_parent"&gt;&lt;/TableRow&gt;
              &lt;TableLayout android:id="@+id/tabla_cuerpo" android:layout_height="match_parent" android:layout_width="match_parent"&gt;
                  &lt;TableRow android:id="@+id/tableRow1" android:layout_width="match_parent" android:layout_height="wrap_content"&gt;
  
                      &lt;TextView android:background="@drawable/cell_shape" android:padding="5dp" android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="TextView"&gt;&lt;/TextView&gt;
                      &lt;TextView android:background="@drawable/cell_shape" android:padding="5dp" android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="TextView"&gt;&lt;/TextView&gt;
                      &lt;TextView android:background="@drawable/cell_shape" android:padding="5dp" android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="TextView"&gt;&lt;/TextView&gt;
  
                  &lt;/TableRow&gt;
                  &lt;TableRow android:id="@+id/tableRow2" android:layout_width="match_parent" android:layout_height="wrap_content"&gt;                    
  
                      &lt;TextView android:background="@drawable/cell_shape" android:padding="5dp" android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="TextView"&gt;&lt;/TextView&gt;
                      &lt;TextView android:background="@drawable/cell_shape" android:padding="5dp" android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="TextView"&gt;&lt;/TextView&gt;
                      &lt;TextView android:background="@drawable/cell_shape" android:padding="5dp" android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="TextView"&gt;&lt;/TextView&gt;&lt;/TableRow&gt;
  
                  &lt;TableRow android:id="@+id/tableRow3" android:layout_width="match_parent" android:layout_height="wrap_content"&gt;                    
  
                      &lt;TextView  android:background="@drawable/cell_shape" android:padding="5dp" android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="TextView"&gt;&lt;/TextView&gt;
                      &lt;TextView android:background="@drawable/cell_shape" android:padding="5dp" android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="TextView"&gt;&lt;/TextView&gt;
                      &lt;TextView android:background="@drawable/cell_shape" android:padding="5dp" android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="TextView"&gt;&lt;/TextView&gt;
  
                  &lt;/TableRow&gt;
                  &lt;TableRow android:id="@+id/tableRow4" android:layout_width="match_parent" android:layout_height="wrap_content"&gt;                    
  
                      &lt;TextView android:background="@drawable/cell_shape" android:padding="5dp" android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="TextView"&gt;&lt;/TextView&gt;
                      &lt;TextView android:background="@drawable/cell_shape" android:padding="5dp" android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="TextView"&gt;&lt;/TextView&gt;
                      &lt;TextView  android:background="@drawable/cell_shape" android:padding="5dp" android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="TextView"&gt;&lt;/TextView&gt;
  
                  &lt;/TableRow&gt;
              &lt;/TableLayout&gt;
  
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>I know how to inflate the layouts and how to insert data in simple <code>TextView</code>:</p>
  
  <pre><code>View v = inflater.inflate(R.layout.subject_report_layout, container,false);
  TextView tv = (TextView ) v.findViewById(R.id.tv);
  TableRow tr = (TableRow) v.findViewById(R.id.tableRow2);
  tv.setText("Text");
  </code></pre>
  
  <p>How can I do the same for all the rows and columns of the table?</p>