Setting android:screenOrientation="sensorLandscape" prevents actiity restart -


i have added android:screenorientation="sensorlandscape" activity in manifest. , there no android:configchanges attribute.

this seems bug me, activity not being re-created i.e. oncreate() not being called when device rotated.

also, onconfigurationchanged() not being called either.

removing line android:screenorientation="sensorlandscape" fixes problem , activity restarted expected.

can confirm bug, and/or there workaround it?

can confirm bug...

this not bug. it's how designed it. according dianne hackborn, this post on google groups (about half-way down):

this not configuration change. there no notification platform provides when this, because invisible environment app in.


...is there workaround it?

a possible workaround register sensors detect orientation change, little more work since orientation sensor deprecated. you'd need magnetic field sensor , accelerometer replace functionality. this post demonstrates using these sensors orientation values.


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -