Wednesday, March 30, 2011

[android-developers] Double lifecycle sequence from landscape to portrait

Remark: posted a question to http://stackoverflow.com/questions/5484108/android-double-lifecycle-sequence-from-landscape-to-portrait. RSVP there. Thank you

Hi everybody

I'm monitoring an Activity lifecycle to learn more on it, so I put a Log.d() call in almost every method of the cycle.

I'm watching particularly the sequence:

[A]onSaveInstanceState() - onPause() - onStop() - onDestroy() - onStart() - [B]onRestoreInstanceState()

Switching a 2.2 Froyo emulator with Ctrl-F11 from portrait to landscape I can see one round from [A] to [B].

What is strange to me is that switching back from landscape to portrait I can see two round from [A] to [B].

onSaveInstanceState() - onPause() - onStop() - onDestroy() - onStart() - onRestoreInstanceState()
onSaveInstanceState
() - onPause() - onStop() - onDestroy() - onStart() - onRestoreInstanceState()

This is creating me lots of issues in saving/restoring the activity state.

Using a 2.3.3 Gingerbread emulator the sequence runs only once. But 2.3.3 emulator has a known bug that prevents it from rotating correctly!

StackOverflow user @Reflog told me that
"Rotation in emulator is different from Accelerator rotation. It actually simulates an open-keyboard. These are two different events, which cause two different lify-cycle flows."

According to Using the Android Emulator there exist only Ctrl-F11/F12 to "Swith to previous/next layout orientation".
Is it not an Accelerator rotation key? How can be it emulated?
What are this "different lifecycle" flows?


Thank you
--
Giorgio Vespucci
giorgio [dot] vespucci [at] gmail [dot] com
Skype, Twitter, Slideshare: gvespucci
http://xpermanwalking.blogspot.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment