I have an Activity
with a fixed orientation, android:screenOrientation="portrait"
in my manifest. I noticed that when pressing Cntl-F11 on the emulator and when a user slides out the keyboard on a device the Activity
is destroyed and onCreate
is called.
Yet when I use a non-slide out keyboard device the Activity
is never destroyed, simply because it is locked to portrait.
Why is there a difference in behavior between devices? Why is an Activity that is locked to portrait, invoking a configuration change? This is really irritating.
Edit: I also experimented with android:configChanges="orientation
without any noticeable difference.
You can probably prevent this by telling Android you want to handle the configuration changes yourself via the configChanges attribute.
However, doesn't this point out why it is a bad idea to force the app to be in portrait? That is really annoying on phones with a keyboard.