screen orientation - The App gets recreated even when android:configChanges is specified? -
i specified in manifest.xml
next tag
<activity android:screenorientation="fullsensors android:configchanges="orientation|keyboardhidden|keyboard" </activity>
and android:configchanges="orientation|keyboardhidden|keyboard"
means avoid recreation of app in case of "orientation" or "keyboard hidden/visible"
and in app class, calling activity's life cycle callbacks. , expected when rotate/re-orient device that, no recreation of app occured. or in other words, next callbacks, in order, not called because of android:configchanges
. callbacks onpause()
onstop()
ondestroy()
oncreate()
onstart()
onresume()
, every time rotate device, app gets recreated , mentioned life cycle's callbacks called.
any explanation why happens?
here have not included screensize
in android:configchanges
.
according doc
caution: origin android 3.2 (api level 13), "screen size" changes when device switches between portrait , landscape orientation. thus, if want prevent runtime restarts due orientation alter when developing api level 13 or higher (as declared minsdkversion , targetsdkversion attributes), must include "screensize" value in add-on "orientation" value. is, must decalare android:configchanges="orientation|screensize". however, if application targets api level 12 or lower, activity handles configuration alter (this configuration alter not restart activity, when running on android 3.2 or higher device).
so if want receive onconfigurationchanged
callback .. have add together screensize
in android:configchanges
.
for more info can see this
android screen-orientation android-lifecycle android-orientation android-configchanges
No comments:
Post a Comment