// Display the data list
Public void shujuList (){
List <Customer> customerList = dao. findALL ();
TableLayout tl = (TableLayout) findViewById (R. id. tlLayout );
Log. I (">>>", String. valueOf (tl. getChildCount ()));
Int j = tl. getChildCount ();
If (j> 1 ){
/* For (int I = 0; I <j; I ++ ){
Tl. removeView (tl. getChildAt (j-I); // The child element must be subtracted from the end.
}*/
For (int I = j; I> 0; I --){
Tl. removeView (tl. getChildAt (I); // The child element must be subtracted from the end.
}
}
TableRow row = null;
For (Customer c: customerList ){
Row = new TableRow (this );
// Id
TextView tvId = new TextView (this );
TvId. setText (c. id + "");
Row. addView (tvId );
// Name
TextView tvName = new TextView (this );
TvName. setText (c. name );
Row. addView (tvName );
// Age
TextView tvAge = new TextView (this );
TvAge. setText (c. teleNumber + "");
Row. addView (tvAge );
Tl. addView (row );
}
}