꿈소년의 개발 이야기

[Android API] onConfigurationChanged 본문

Android Development

[Android API] onConfigurationChanged

꿈소년 2010. 10. 8. 13:02
반응형


@Override
public void onConfigurationChanged(Configuration newConfig) {
 
super.onConfigurationChanged(newConfig);
  setContentView
(R.layout.myLayout);
}

Parent Activity 에서 Child Activity 를 불러 낼 경우, Orientation 이 change 될 때 top activity 만 회전을 수행한다.

기본적으로 Full-screen 속성으로 간주되는 activity만 회전을 수행한다.

top 이 아닌 stack에 쌓인 아래 activity는 실제 Top으로 올라올 경우에 Rotation 여부를 체크하여 수행한다. 

stack에서 top으로 올라올때 체크해주므로 갱신되거나 초기화되는 경우가 생길 수 있다.
(비록 androidmanifest.xml에서 속성을 줬더라도..)

해결점.
activity에 전부 아래 속성을 넣어준다. 
android:configChanges="keyboardHidden|orientation"
or
top에 있는 액티비티가 full-screen이 아니라고 지정한다. 즉, AndroidManifest.xml에서 child activity의 속성중에 theme를 android:theme="@android:style/Theme.Translucent" 로 지정한다.

'Android Development' 카테고리의 다른 글

[Android development] Flashing Froyo 2.2 on ADP2  (0) 2010.10.12
[Intent] Intent 를 통한 다른 어플  (0) 2010.10.11
Service  (0) 2010.08.16
Power Management  (0) 2010.08.16
Activity & Task  (0) 2010.08.13