Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Orientation change in Honeycomb

I have an activity that shouldn't be recreated after an orientation change. I added the following to the activity declaration in the manifest:

android:configChanges="orientation"

On Android 2.3 this works perfectly. On HONEYCOMB_MR2 onCreate is called anyway when change the orientation.

Is there something else that needs to be done on HONEYCOMB_MR2 to prevent recreating the activity after an orientation change?

like image 444
hpique Avatar asked Aug 06 '11 16:08

hpique


1 Answers

Apparently using orientation|screenSize (?) prevents onCreate on Honeycomb and (so far) does not seem to break anything in previous Android versions.

android:configChanges="orientation|screenSize"

No idea why this is necessary and I don't really understand the documentation about this new value.

I suspect that in HONEYCOMB_MR2 upon an orientation change the activity considers this as two config changes: orientation and screen size. And both attempt to recreate the activity by default.

like image 144
hpique Avatar answered Oct 17 '22 05:10

hpique