title: How to add multiple table row?
body: <p><a href="https://i.stack.imgur.com/UKwKU.png" rel="nofollow noreferrer">Only show one row(last data)</a></p>
  
  <p>I did not get multiple row.There is showing only one row. How to solve this problem.</p>
  
  <p>//Activity</p>
  
  <pre><code>public class TableViewActivity extends AppCompatActivity {
  
      TableLayout tableLayout;
      TableRow tableRow;
      TextView textView1, textView2;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_table_view);
          tableLayout = (TableLayout) findViewById(R.id.tableLayout);
          tableRow = (TableRow) findViewById(R.id.tableRow2);
          textView1 = (TextView) findViewById(R.id.TextViewRowTwo1);
          textView2 = (TextView) findViewById(R.id.TextViewRowTwo2);
  
          List&lt;Student&gt; students = new ArrayList&lt;&gt;();
          students.add(new Student(1, "Mahmud"));
          students.add(new Student(2, "Saiful"));
          students.add(new Student(3, "Monir"));
          students.add(new Student(4, "Milton"));
  
  
          for (int j = 0; j&lt; students.size(); j++) {
  
              textView1.setText(students.get(j).getId()+"");
              textView2.setText(students.get(j).getName());
  
              // TEXTVIEW
              if(textView1.getParent()!=null)
                  ((ViewGroup)textView1.getParent()).removeView(textView1); // &lt;- fix
              tableRow.addView(textView1);
  
              if(textView2.getParent()!=null)
                  ((ViewGroup)textView2.getParent()).removeView(textView2); // &lt;- fix
              tableRow.addView(textView2);
  
              if(tableRow.getParent()!=null)
                  ((ViewGroup)tableRow.getParent()).removeView(tableRow); // &lt;- fix
              tableLayout.addView(tableRow);
  
          }
  
          setContentView(tableLayout);
  
      }
  
  }
  </code></pre>