allan.conda
06/22/2022, 5:48 AMTextFields
?lilypuchi
06/22/2022, 6:19 AMrememberSaveable
is what you’re looking for?
https://developer.android.com/jetpack/compose/state#restore-ui-stateallan.conda
06/22/2022, 6:30 AMgildor
06/22/2022, 9:57 AMallan.conda
06/22/2022, 10:28 AMsavedStateHandle
, Similar when we used to just save everything manually with onSaveInstanceState
during MVP era
We enable “Don’t keep activities” to detect such issues easily, do we have a bunch of tickets related to this.Colton Idle
06/22/2022, 10:41 AMmyanmarking
06/22/2022, 10:41 AMallan.conda
06/22/2022, 11:01 AMgildor
06/22/2022, 11:03 AMmyanmarking
06/22/2022, 11:05 AMallan.conda
06/22/2022, 11:06 AMonSaveInstanceState
, right? You wouldn’t want to restore all your states, just some of it like text inputsavedStateHandle
myanmarking
06/22/2022, 11:07 AMallan.conda
06/22/2022, 11:08 AMmyanmarking
06/22/2022, 11:09 AMallan.conda
06/22/2022, 11:11 AMHalil Ozercan
06/22/2022, 11:17 AMmutableStateOf
. If the source of TextField state is a StateFlow, you might experience bugs due to synchronization problems between Snapshot system and the source. This ideally shouldn't affect how you save and restore your state.allan.conda
06/22/2022, 11:26 AMStateFlow
with collectAsState
should be good enough, right?Ale Stamato
06/22/2022, 1:45 PMRick Regan
06/22/2022, 1:47 PMTextField
in a settings screen whose value is declared locally as rememberSaveable { mutableStateOf(...) }
and is saved to a Preferences DataStore (within a coroutine) in the KeyboardActions
onDone
callback.myanmarking
06/22/2022, 1:49 PMIan Lake
06/22/2022, 3:05 PMsaveable
, which lets you have rememberSaveable
like behavior in your ViewModel: https://developer.android.com/reference/kotlin/androidx/lifecycle/viewmodel/compose/package-summary#(androidx.lifecycle.SavedStateHandle).saveable(androidx.compose.runtime.saveable.Saver,kotlin.Function0)allan.conda
06/22/2022, 3:56 PMsetSavedStateProvider
which triggers the provider , then put the parcelable in a bundle.