views:

56

answers:

1

I have a dynamic table layout created in OnCreate(). Everytime the activity resumes, the data in the table rows can change, so I would like to destroy the table rows and create new ones. How can I do that? Thanks!!!

Here is what the OnCreate table creation portion looks like:

    tableLayout tl = new TableLayout(this);

    for (i = 0; i < numberOfVariables; i++) {

        TableRow tr = new TableRow(this);

        CheckBox cb = new CheckBox(this);
        tr.addView(cb);

        TextView dv = new TextView(this);
        tr.addView(dv);

        EditText et = new EditText(this);
        tr.addView(et);

        tl.addView(tr);
    }

    ll.addView(tl);
A: 

Just use tl.removeAllViews();, and then recreate the rows.

Cristian
How could I have missed that????
Mike W.
Thanks a lot! That did the trick.
Mike W.