title: Android TableLayout Add new Row with data from EditText by clicking a button
body: <p>I have an empty <code>tablelayout</code> setup on the <code>MainActivity</code> and I have another activity called <code>Add_Item</code> where I have a few <code>EditText</code>'s where the user can submit information to add to the <code>tablelayout</code>. The part im stuck on is how to actually save the data inserted into the <code>EditText</code>into a new row each time the user presses the save button. Is there a tutorial some where on how to do this with example code? I am only finding ones with sql which I do not need. Below is the code I have so far of the XML and <code>Add_Item</code> activity</p>
  
  <p>//Add_Item Activity</p>
  
  <pre><code>package com.example.moduleonesimpleapplication;
  
  import android.os.Bundle;
  import android.support.v7.app.ActionBarActivity;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.ArrayAdapter;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.Spinner;
  
  public class Add_Item extends ActionBarActivity {
      //variables
      EditText TaskNameET;
      Spinner SpinType;
      Button SaveTodo;
      String SpinnerOptions[] = {"OptionOne", "OptionTwo", "OptionThree"};
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_add__item);
  
          //define vars
          TaskNameET = (EditText) findViewById(R.id.TaskNameET);
          SpinType = (Spinner) findViewById(R.id.spinner1);
          SaveTodo = (Button) findViewById(R.id.button1);
  
          //adapter for spinner
          ArrayAdapter&lt;String&gt; ard=new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_dropdown_item_1line, SpinnerOptions);
          SpinType.setAdapter(ard);
  
          //onclick todobutton
          SaveTodo.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  // TODO Auto-generated method stub
                  //here is the save button, I would like to save the information inputted from the TaskNameET EditText Into the TableLayout
                  // I have the tablelayout defined as TableRow
                  //MainActivity.this.TableRow.setTextAlignment();
                  Add_Item.this.TaskNameET.getText().toString();
              }
          });
      }
  
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.add__item, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
          if (id == R.id.action_settings) {
              return true;
          }
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>
  
  <p>//XML for tablelayout</p>
  
  <pre><code>&lt;RelativeLayout 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="com.example.moduleonesimpleapplication.MainActivity" &gt;
  
      &lt;Button
          android:id="@+id/button1"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          android:layout_centerHorizontal="true"
          android:text="@string/AddItemButton" /&gt;
  
      &lt;TableLayout
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentTop="true"
          android:layout_centerHorizontal="true" &gt;
  
         &lt;TableRow
              android:id="@+id/tableRow1"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content" &gt;
  
          &lt;/TableRow&gt;
  
          &lt;TableRow
              android:id="@+id/tableRow2"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content" &gt;
          &lt;/TableRow&gt;
  
          &lt;TableRow
              android:id="@+id/tableRow3"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content" &gt;
          &lt;/TableRow&gt;
  
          &lt;TableRow
              android:id="@+id/tableRow4"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content" &gt;
          &lt;/TableRow&gt;
      &lt;/TableLayout&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>