You must call removeView() on the child's parent first. (Error occurred when i try to add rows dynamically) :Android : The above error occurred while  i try to add row dynamically to my tableview
Main code of activity
I have tried many solutions available in stackoverflow. But nothing solved my problem

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->

    package com.example.bhramaram.myapplication;

    import android.content.Context;
    import android.database.Cursor;
    import android.os.Bundle;
    import android.support.v7.app.AlertDialog;
    import android.support.v7.app.AppCompatActivity;
    import android.view.ViewGroup;
    import android.widget.TableLayout;
    import android.widget.TableRow;
    import android.widget.TextView;

    import com.example.bhramaram.myapplication.Dbhelper;
    import com.example.bhramaram.myapplication.R;

    public class jav extends AppCompatActivity {
        TableLayout tb;
        TableRow tableRow;
        Dbhelper dbhelper;
        @Override
        public void onCreate(Bundle savedInstanceState){
            int day=0;
            super.onCreate(savedInstanceState);
            setContentView(R.layout.timetable);
            getvalues();
        }

        private void getvalues() {

            tb=(TableLayout)findViewById(R.id.timetble);
            TextView textView1,textView2,textView3,textView4,textView5,textView0;
            textView0=new TextView(this);textView1=new TextView(this);
            textView2=new TextView(this);textView3=new TextView(this);
            textView4=new TextView(this);textView5=new TextView(this);
            TableRow.LayoutParams lp = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT);
            textView0.setLayoutParams(lp);textView1.setLayoutParams(lp);
            textView2.setLayoutParams(lp);textView3.setLayoutParams(lp);
            textView4.setLayoutParams(lp);textView5.setLayoutParams(lp);
            dbhelper= new Dbhelper(jav.this);
            Cursor cursor= dbhelper.recieveData();

            if(cursor.getCount()==0){
                alert("Nothing","Nothing to show");
                return;}
            int i=0;
            while (cursor.moveToNext())
            {
                tableRow=new TableRow(this);

                TableLayout.LayoutParams lp1=new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT,TableLayout.LayoutParams.MATCH_PARENT);

                textView0.setText((cursor.getString(0)));textView1.setText((cursor.getString(1)));
                textView2.setText((cursor.getString(2)));textView3.setText((cursor.getString(3)));
                textView4.setText((cursor.getString(4)));textView5.setText((cursor.getString(5)));
                tableRow.setLayoutParams(lp);
                //Error occurred here
                tableRow.addView(textView0);tableRow.addView(textView1);
                tableRow.addView(textView2);tableRow.addView(textView3);
                tableRow.addView(textView4);tableRow.addView(textView5);
                tb.addView(tableRow,lp1);

            }



        }

        private void alert(String title, String alert) {
            AlertDialog.Builder builder=new AlertDialog.Builder(this);
            builder.setCancelable(true);
            builder.setTitle(title);
            builder.setMessage(alert);
        }


    }


<!-- end snippet -->
corresponding xml file

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->

    <?xml version="1.0" encoding="utf-8"?>
    <android.support.constraint.ConstraintLayout
        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">

        <TableLayout
            android:id="@+id/timetble"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            tools:layout_editor_absoluteX="8dp"
            tools:layout_editor_absoluteY="8dp"
            tools:ignore="MissingConstraints">
        </TableLayout>
    </android.support.constraint.ConstraintLayout>

<!-- end snippet -->

Error details<br/>

 Process: com.example.bhramaram.myapplication, PID: 14266
                  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.bhramaram.myapplication/com.example.bhramaram.myapplication.jav}: 'java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.'
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
                      at android.app.ActivityThread.-wrap12(ActivityThread.java)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
                      at android.os.Handler.dispatchMessage(Handler.java:102)
                      at android.os.Looper.loop(Looper.java:154)
                      at android.app.ActivityThread.main(ActivityThread.java:6077)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
                   Caused by: 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:4460)
                      at android.view.ViewGroup.addView(ViewGroup.java:4301)
                      at android.view.ViewGroup.addView(ViewGroup.java:4241)
                      at android.view.ViewGroup.addView(ViewGroup.java:4214)
                      at com.example.bhramaram.myapplication.jav.getvalues(jav.java:60)
                      at com.example.bhramaram.myapplication.jav.onCreate(jav.java:29)
                      at android.app.Activity.performCreate(Activity.java:6705)
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)

Please tell me the reason why i am getting this error. I am stuck here for 2 days.<br/>
Also I am a newcomer to android developers community. This project is about an app that uses local sqlite database to store and display time table. I follow the method which i found from the web to show the results in table. It will be helpful to me if you can suggest more efficient methods for this code snippet