Question

Looked at other posts but, haven't seen the answer I'm looking for...

I have two layouts: layout-port and layout-land.
If I run the app with emulator or device, either vertically or horizontally, the app runs fine with the correct layouts.

However, if I rotate either the emulator or device, the app exits. There's no crashing, perse', it just exits.

I have other app's with similarly defined layouts that work fine without any orientation handling in the manifest. I'm not concerned about persisting data.

The main differences between the one's that work and this one are (this one has):
* Menus with sub-menus
* Dialog screens (not the android dialog widget)
* Tab widget

All of the above items work in their respective layouts (port and land), the app just exits when rotating the emulator or device and I need to restart the app.

Any recommendations? Thanks alt text

The Manifest:

(deleted)

Was it helpful?

Solution

If you use the above code, make one modification:

android:configChanges="keyboard|keyboardHidden|orientation"

using only "orientation" will handle orientation changes driven by accelerometers and such, but on devices with a physical keyboard and a slide-out screen the activity will still be shut down and restarted any time a user slides open their keyboard.

OTHER TIPS

Did you try to add android:configChanges="orientation" to your activity declaration in the manifest? Normally when the configuration changes, the activity is shut down and restarted. Adding this "flag" prevents this and calls the onConfigurationChanged() method instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top