2012-12-27 1 views
0

정보 도착을 기다리는 테이블 레이아웃이 있습니다. 데이터가 도착하면 테이블을 동적으로 채 웁니다. 하지만 전화기를 90도 돌리면 테이블이 사라집니다. 코드 :전화가 돌아 왔을 때 테이블 레이아웃 손실 정보 (안드로이드)

{ 
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 
} 

내가 전화를 켤 때 나는 테이블 정보를 보유하고 사라하지를 원한다면 나는 어떻게해야합니까?

답변

0

이 중요한 것은 android:configChanges="orientation|screenSize"

에게 있습니다

<activity android:theme="@style/Theme.app" android:configChanges="orientation|screenSize" android:name=".YourActivity" android:label="@string/app_name"></activity> 

simpliest 방법

관련 문제