The reason is, starting from Android 3.2 (API Level 13), rotated device will also trigger "screenSize" change. From attrs_manifest.xml:
<!-- The current available screen size has changed. If applications don't target at least {@link android.os.Build.VERSION_CODES#HONEYCOMB_MR2} then the activity will always handle this itself (the change will not result in a restart). This represents a change in the currently available size, so will change when the user switches between landscape and portrait. --> <flag name="screenSize" value="0x0400" />
It means, if your android:targetSdkVersion is 13 or more, your application will receive "screenSize" config change. Therefore, to prevent your activity from restarting, add "screenSize". E.g.
android:configChanges="keyboardHidden|orientation|screenSize"
Hope this helps you.
No comments:
Post a Comment