I have an app that works only in portrait mode, and I have made the changes in my manifest file for every activity the orientation to be portrait. But when I rotate the device, the activity recreates again. How to not destroy the activity?
+3
A:
add
android:configChanges="orientation"
to your Activity in AndroidManifest.xml. This way your Activity wont be restarted automatically. See the documentation for more infos
flurin
2010-07-25 14:11:47
The activity is restarted again.I don't know what's the point of doing all the stuff that has to be done when the activity rotates, even if it is not rotating virtually. Is there a way to disable that messages that the sensor sends to the OS about the rotation, or something like that, to fix this problem from its root?
2010-07-27 00:56:54
on what device are you programming? remember, that for example sliding out the keyboard could also restart your activity... (if that's the reason set confChanges to "keyboard|keyboardHidden|orientation")
flurin
2010-07-27 17:29:09
A:
Look at this code in Floating Image. It has the most interesting way of handling screen rotation ever. http://code.google.com/p/floatingimage/source/browse/#svn/trunk/floatingimage/src/dk/nindroid/rss/orientation
androidworkz
2010-07-26 12:20:54