1

I have added configChanges option to activity description because I want to handle screen rotation events in onConfigurationChanged. Here is excerpt from activity config

<activity
  android:name=".MainActivity"
  android:configChanges="keyboardHidden|orientation"
  android:label="@string/title_activity_main">

  .........

</activity>

But despite the setting activity is destroyed anyway on every screen rotation.

Is this expected behavior? I read elsewhere that configuration changes should not cause activity destroy if this change is in activity's configChanges.

Am I better not using onConfigurationChange and instead optimize for onDestroy/onCreate sequence?

4

1 回答 1

4

从 Android 3.2 开始,您还需要添加“screenSize”:

android:configChanges="keyboardHidden|orientation|screenSize"

来源:http: //developer.android.com/guide/topics/resources/runtime-changes.html#HandlingTheChange

于 2013-05-26T10:44:54.313 回答