Instruction

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

In a previous lesson, you learned about the remember composable function. The remember function saves the state across recomposition. However, the state would be lost when a configuration change occurs.

To save state across a configuration change like screen rotation, use the rememberSaveable composable function. rememberSaveable saves state values in a Bundle object.

This is how you’d create a MutableState object in a composable using the rememberSaveable function:

var friendsName by rememberSaveable { mutableStateOf("") }

In the next lesson, you’ll use rememberSaveable in a hands-on experience to save state across configuration changes in the Wellness Club App.

See forum comments
Download course materials from Github
Previous: Introduction Next: Demo