I had a strange problem. I am creating a table by inflating the table row like this
TableLayout table = (TableLayout) findViewById(R.id.tablelay);
LayoutInflater inflater = getLayoutInflater();
for (int j = 0; j < limit ; j++) {
TableRow row = (TableRow) inflater.inflate(R.layout.row_details, table, false);
t1 = (TextView) row.findViewById(R.id.firstTxt);
t1.setText(""+ firstData[j]);
t2 = (TextView) row.findViewById(R.id.secondTxt);
t2.setText(""+ secondData[j]);
table.addView(row, new TableRow.LayoutParams(
TableRow.LayoutParams.FILL_PARENT,
TableRow.LayoutParams.WRAP_CONTENT));
}
The "row_details.xml" is a layout contains two textviews ("firstTxt" ,"secondTxt"). I am able to add data and is displayed on the screen.
The problems comes when i rotate it to landscape mode, then all the data is lost. Initially i thought this may due to orientation problem (ie data loss due to reloading the activity).
But first time when i load the activity in landscape mode then no data is displayed and now rotating to portrait mode shows the data. So i think this is due to inflating in landscape mode.
Observation :- portrait view shows data and landscape view shows no data
how do i solve this problem ?....thanks in advance.