I have a table layout, which waits for an information to arrive. When the data arrives, I fill the table dynamically. But when I turn the phone 90 degree, the table disappears.
The code:
{
TableRow row;
TextView t1, t2;
ArrayList<InfoPair> values;
values = processResults(r);
Iterator it = values.iterator();
while (it.hasNext()) {
InfoPair pairs = (InfoPair) it.next();
row = new TableRow(c);
t1 = new TextView(c);
t2 = new TextView(c);
// t1.setTextLocale(new Locale("hu", "hu"));
t1.setText(pairs.getLabel());
t2.setText(pairs.getValue());
t1.setWidth(200);
t2.setWidth(280);
t1.setBackgroundColor(Color.GRAY);
t2.setBackgroundColor(Color.YELLOW);
row.addView(t1);
row.addView(t2);
infoTable.addView(row);
it.remove(); // avoids a ConcurrentModificationException
}
What should I do, if I want the table to hold the information and not to disappear when I turn the phone?
The simpliest way
this is the main thing
android:configChanges="orientation|screenSize"