It is possible to avoid the call to onCreate when you changue from landscape to portrait?
How?
thanks
It is possible to avoid the call to onCreate when you changue from landscape to portrait?
How?
thanks
Absolutely possible, in AndroidManifest.xml
add this to activity:
android:configChanges="orientation|keyboardHidden"
you can read more information about this tip on my article: http://xjaphx.wordpress.com/2011/09/19/the-less-known-over-screen-orientation/
Read this article Handling Runtime Changes. Basically there are two options
Let android handle configuration changes - then your activity will be recreated and onCreate
will be invoked again.
Handle it yourself - then your activity won't be destroyed.
Yes it is possible to do this, by adding android:configChanges="orientation"
to your manifest.
However, by choosing this path, you lose much of the great resource management in Android.
If you want to appropriately save and restore state since the activity is recreated without the above manifest change, then you will want to look at onSaveInstanceState () and onRestoreInstanceState ()
add this to manifest of the activity - android:configChanges="orientation"