开发者

Android - Orientation Change - exits app but w/o crashing

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 i开发者_StackOverflown 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

Android - Orientation Change - exits app but w/o crashing

The Manifest:

(deleted)


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜