Se7eN
10/10/2020, 3:41 PMsavedInstanceState
with MutableState
val themeColor by savedInstanceState(user) { mutableStateOf(Color.Blue) }
but I'm getting this error:
java.lang.IllegalArgumentException: Please use savedInstanceState() if you want to save a MutableState
What am I doing wrong here?gildor
10/10/2020, 3:44 PMSe7eN
10/10/2020, 3:46 PMIf you work with immutable objects savedInstanceState can suit you more as it wraps the value into the MutableState.
gildor
10/10/2020, 3:46 PMSe7eN
10/10/2020, 3:47 PMSe7eN
10/10/2020, 3:47 PMgildor
10/10/2020, 3:49 PMSe7eN
10/10/2020, 3:51 PMSe7eN
10/10/2020, 3:52 PMSe7eN
10/10/2020, 4:04 PMvar themeColor by rememberSavedInstanceState { mutableStateOf(Color.Black) }
Se7eN
10/10/2020, 4:04 PMsavedInstanceState
Zhelyazko Atanasov
10/10/2020, 7:37 PMSaver
and convert the Color
to/from Int
Andrey Kulikov
10/10/2020, 11:45 PM