android_catalogue1-5 Exercise 2: Dialog and Rotation ===================================================== With rememberSaveable the dialog survives rotation. Why: rotating recreates the activity and the composition. rememberSaveable stores its value in the saved-instance-state bundle and restores it into the new composition, so showConfirm is still true and the dialog is shown again. With plain remember, the value is lost on rotation: showConfirm resets to false and the dialog silently disappears. The item is still on screen and nothing was deleted, which is safe, but it is annoying and looks like a bug to the user. The rule of thumb used in this course: UI-only state that the user would be annoyed to lose (a dialog, a scroll position, text typed in a field) uses rememberSaveable; state other code needs lives in a ViewModel.