2013-07-30 2 views
0

내 app에서 동작 표시 줄 조각을 사용하고 있습니다. 화면이 회전하면 작업 표시 줄의 내용이 손실되어 유지 방법을 제안하십시오. 여기에 해당동작 표시 줄의 내용이 표시되지 않습니다.

@Override 
protected void onSaveInstanceState(Bundle outState) { 
     super.onSaveInstanceState(outState); 
     if(currentDisplayedCase != null) { 
      outState.putInt(DISPLAY_CASE_KEY, currentDisplayedCase.intValue()); 

     } 
     outState.putString(ACTION_BAR_TEXT, textView1.getText().toString()); 
    } 

과 장치가 회전되면

if(savedInstanceState!=null&&savedInstanceState.containsKey(ACTION_BAR_TEXT)) 
     textView1.setText(savedInstanceState.getString(ACTION_BAR_TEXT, null)); 

답변

0

가 활성이 다시에서 onCreate 방법에서 수행하고있는 코드이다.

적절한 솔루션을 위해 당신은 링크

그것은 당신의 데이터가 손실되어이를 복구하는 방법을 이유를 이해하는 데 도움이됩니다

Losing data when rotate screen

다음을 참조 할 수 있습니다.

+0

지금도 동일하게하고 있지만 설정 변경시 콘텐츠를 가져 오지 못합니다. – Supreet

0

매니페스트 파일 android의 활동 선언에 다음을 추가해야합니다. configChanges = "orientation", i. 이자형.

<activity android:name=".myActivity" android:configChanges="orientation" android:label="@string/txt_app_name" android:theme="@style/myTheme" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>

이것은 당신이 당신의 활동 방향 변경을 처리된다는 것을 의미합니다.

관련 문제