I am trying to add table rows dynamically...... 
Following is my java code:

```
TableLayout tl = (TableLayout) findViewById(R.id.tablerow);
        /* Create a new row to be added. */
        TableRow tr = new TableRow(this);
        tr.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,   LayoutParams.WRAP_CONTENT));
        /* Create a Button to be the row-content. */
        Button b = new Button(this);
        b.setText("Dynamic Button");
        b.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
        /* Add Button to row. */
        tr.addView(b);
        /* Add row to TableLayout. */
        tl.addView(tr, new TableLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));

```

My XML code is

```
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/tablerow"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <TableRow>
        <TextView
            android:id="@+id/content"
            android:singleLine="false" />
    </TableRow>

</TableLayout>

```

But I get error at this line:

```
final TableLayout tl = (TableLayout)findViewById(R.id.tablerow);

```

Error I get is **Cannot cast from view to TableLayout**

Any help will be appreciated