I got a force close when adding table row programatically?
<p>HI am doing table layout programatically for that when i add table row to the layout application shows force close can any body help me and following is my code</p>

<pre><code>TableLayout tl = (TableLayout) findViewById(R.id.maintable);
    TableRow tr = new TableRow(this);
    TextView labelTV = new TextView(this);
    TextView valueTV = new TextView(this);
    // Go through each item in the array
    for (int current = 0; current &lt; numProvinces; current++)
    {
        // Create a TableRow and give it an ID

        tr.setId(100+current);
        tr.setLayoutParams(new LayoutParams(
                LayoutParams.FILL_PARENT,
                LayoutParams.WRAP_CONTENT));   

        // Create a TextView to house the name of the province

        labelTV.setId(200+current);
        labelTV.setText(provinces[current]);
        labelTV.setTextColor(Color.WHITE);
        labelTV.setLayoutParams(new LayoutParams(
                LayoutParams.FILL_PARENT,
                LayoutParams.WRAP_CONTENT));
        tr.addView(labelTV);

        // Create a TextView to house the value of the after-tax income

        valueTV.setId(current);
        valueTV.setText("$0");
        valueTV.setTextColor(Color.WHITE);
        valueTV.setLayoutParams(new LayoutParams(
                LayoutParams.FILL_PARENT,
                LayoutParams.WRAP_CONTENT));
        tr.addView(valueTV);

        // Add the TableRow to the TableLayout
        tl.addView(tr,new TableLayout.LayoutParams(
                LayoutParams.FILL_PARENT,
                LayoutParams.WRAP_CONTENT));
        setContentView(tl);   
    }
</code></pre>
