title: Unable to addView because of unknown parent?
body: <p>I am trying to create a table. The number of rows however will vary each time the app is loaded so i add them programatically. Rows have their own xml layout aside from the mainLayout. However when trying to add rows to the tableview in the mainlayout i get an error (tableLayou.addView(row)). here is my code:</p>
  
  <pre><code>private void makeTable() {
      View v = getLayoutInflater().inflate(R.layout.row, null);
      TableRow row;
      AutofitTextView textView;
      Configuration configuration = getResources().getConfiguration();
      int dip = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
              (float) 1, getResources().getDisplayMetrics());
      int width = (configuration.screenWidthDp/8)*dip;
      int height = (configuration.screenHeightDp/10)*dip;
      v.setBackgroundColor(getResources().getColor(R.color.black));
      for (int i = 0; i&lt;rowss.size();i++) {
  
          row =(TableRow) v.findViewById(R.id.tableRow);
          Scanner scanner = new Scanner(rowss.get(i));
          while(scanner.hasNextLine()) {
              Scanner s = new Scanner(scanner.nextLine());
              AutofitTextView textView1 = (AutofitTextView) row.findViewById(R.id.manufacturer);
              textView1.setText(s.next());
          }
  
          tableLayout.addView(row);
  
      }
  
  }
  </code></pre>
  
  <p>Row.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;TableRow xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="horizontal" android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:id="@+id/tableRow"
      android:weightSum="8"&gt;
      &lt;me.grantland.widget.AutofitTextView
          android:id="@+id/manufacturer"
          android:layout_width="0dp"
          android:layout_weight="1"
          android:layout_height="wrap_content" /&gt;
  
      &lt;me.grantland.widget.AutofitTextView
          android:layout_width="0dp"
          android:id="@+id/name"
          android:layout_weight="1"
          android:layout_height="wrap_content" /&gt;
  
      &lt;me.grantland.widget.AutofitTextView
          android:layout_width="0dp"
          android:id="@+id/reason"
          android:layout_weight="1"
          android:layout_height="wrap_content" /&gt;
  
  
      &lt;me.grantland.widget.AutofitTextView
          android:layout_width="0dp"
          android:layout_weight="1"
          android:id="@+id/block"
          android:layout_height="wrap_content" /&gt;
  
  
      &lt;me.grantland.widget.AutofitTextView
          android:layout_width="0dp"
          android:layout_weight="1"
          android:id="@+id/carrier"
          android:layout_height="wrap_content" /&gt;
  
  
      &lt;me.grantland.widget.AutofitTextView
          android:layout_width="0dp"
          android:layout_weight="1"
          android:id="@+id/quantity"
          android:layout_height="wrap_content" /&gt;
  
  
      &lt;me.grantland.widget.AutofitTextView
          android:layout_width="0dp"
          android:layout_weight="1"
          android:id="@+id/inventory"
          android:layout_height="wrap_content" /&gt;
  
      &lt;CheckBox
          android:layout_width="0dp"
          android:id="@+id/status"
          android:layout_weight="1"
          android:layout_height="wrap_content" /&gt;
  
  
  
  
  &lt;/TableRow&gt;
  </code></pre>
  
  <p>activity_main:</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"
      android:id="@+id/content_main"&gt;
      &lt;Button
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:id="@+id/button"/&gt;
  
      &lt;TableLayout
          android:id="@+id/table"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_gravity="center_horizontal"/&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
                                                                                         at android.view.ViewGroup.addViewInner(ViewGroup.java:4654)
                                                                                         at android.view.ViewGroup.addView(ViewGroup.java:4490)
                                                                                         at android.widget.TableLayout.addView(TableLayout.java:426)
                                                                                         at android.view.ViewGroup.addView(ViewGroup.java:4431)
                                                                                         at android.widget.TableLayout.addView(TableLayout.java:408)
                                                                                         at android.view.ViewGroup.addView(ViewGroup.java:4404)
                                                                                         at android.widget.TableLayout.addView(TableLayout.java:399)
                                                                                         at com.intellidev.earlyupgradepicklist.MainActivity.makeTable(MainActivity.java:460)
                                                                                         at com.intellidev.earlyupgradepicklist.MainActivity.access$300(MainActivity.java:64)
                                                                                         at com.intellidev.earlyupgradepicklist.MainActivity$MakeRequestTask.onPostExecute(MainActivity.java:411)
                                                                                         at com.intellidev.earlyupgradepicklist.MainActivity$MakeRequestTask.onPostExecute(MainActivity.java:331)
                                                                                         at android.os.AsyncTask.finish(AsyncTask.java:651)
                                                                                         at android.os.AsyncTask.access$500(AsyncTask.java:180)
                                                                                         at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
                                                                                         at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                         at android.os.Looper.loop(Looper.java:158)
                                                                                         at android.app.ActivityThread.main(ActivityThread.java:7229)
                                                                                         at java.lang.reflect.Method.invoke(Native Method)
                                                                                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
                                                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
  </code></pre>