Rotation and Activity lifecycle change?

The book says I should expect rotation to reveal the first question (after changing to the second before rotating) and it does not. Additionally with the logging in place mentioned in this chapter, the activity is not killed and resurrected as supposed. The second is the reason for the first, I deduced, but the question is: what changed? Is the simulator showing behavior now part of Android OS (I’m emulating the Pixel 4, API 32) or have I don’t something unaware?

Did you make sure to enable auto-rotation? The emulator disables rotation by default now, so you might need to toggle that setting. Once rotation happens, you should see the bug appear.

I may have enabled rotation when I installed it. That would answer my question. Thanks.

However, just because rotation happens the view maintains data, not changing it as the book suggests. IE, when I click the Next button and question 2 is displayed, rotating does not change the question selection to 1. It remains on the second question.The solution is supposed to be in Chapter 4 and the intro of a ViewModel.


I’m really surprised you are seeing this happen. Just to be clear and to make sure we are on the same page, currently, once you go to question 3 or 4, and then rotate the device to see the app in landscape mode, when the UI is in landscape, it still is showing that particular question, right?

In Logcat, are you seeing any logs to suggest that the Activity is being recreated?

More that what I said before, Logcat shows no activity, no start, no close, no resume, when I rotate. That tells me it’s not doing what I know used to happen, and what the book tells me is supposed to happen, when rotating.


I will point out that all of my comments refer to the emulator, not my hw phone. Does that matter?

Emulator vs hardware device should not matter.

Just to make sure we are not missing anything, when you rotate the emulator, you see the UI that looks like this:

and not this: