In which task and step of the codelab can this issue be found?
Step 7
Describe the problem
An explanation is lacking why, even with remember, on screen orientation changes result in all entered data being lost. Even when you entered a tip amount, tip percentage and toggled "round up tip", all this is gone when your phone switches to landscape.
This is very user-unfriendly. I might have typed out the bill amount and tip percentage. Now I want to show it to my friend, but I rotate my phone a bit too far by accident and trigger landscape. All information is now gone and I have to start from scratch.
An explanation of why remember in this situation is not enough and what is the best course of action if I want to make the app robust against losing the state on rotation would be very helpful.
Steps to reproduce?
Deploy on actual Android (14) device with "Auto rotate" on.
Have phone in Portrait mode
Fill out text fields and toggle switch button
Rotate phone so it switches to landscape
Observe the text inputs and toggle button reset to default
VersionsAndroid Studio version:API version of the emulator:
Additional informationInclude screenshots if they would be useful in clarifying the problem.
URL of codelab https://developer.android.com/codelabs/basic-android-kotlin-compose-calculate-tip?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-2-pathway-3%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-calculate-tip#6
In which task and step of the codelab can this issue be found? Step 7
Describe the problem An explanation is lacking why, even with
remember
, on screen orientation changes result in all entered data being lost. Even when you entered a tip amount, tip percentage and toggled "round up tip", all this is gone when your phone switches to landscape.This is very user-unfriendly. I might have typed out the bill amount and tip percentage. Now I want to show it to my friend, but I rotate my phone a bit too far by accident and trigger landscape. All information is now gone and I have to start from scratch.
An explanation of why
remember
in this situation is not enough and what is the best course of action if I want to make the app robust against losing the state on rotation would be very helpful.Steps to reproduce?
Versions Android Studio version: API version of the emulator:
Additional information Include screenshots if they would be useful in clarifying the problem.