Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [viewmodel-savedstate]

The tag has no usage guidance.

viewmodel-savedstate
0 votes
0 answers
18 views

Initialise SavedStateHandle in shared view model

I have a parent fragment and a child fragment which have a shared viewmodel. The viewmodel uses the SavedStateHandle to retain viewmodel state even after process kill. The parent fragment uses shared ...
Tushar Singhal's user avatar
1 vote
1 answer
73 views

Is it possible to save and extract a savedStateHandle (viewmodel) without using NavHost?

I am using NavigableListDetailPaneScaffold, to show list of items and then it's details when clicked. The screen is accompanied by its viewModel and I would love to run the fetching code in the ...
Kinyo356's user avatar
  • 167
1 vote
1 answer
611 views

FATAL EXCEPTION: main java.lang.IllegalArgumentException: CreationExtras must have a value by `SAVED_STATE_REGISTRY_OWNER_KEY`

i hope you can find my text cause i really confused with my project because the app can't installed in emulator. I wish your advice and guidance. this the Logcat when running the app FATAL EXCEPTION: ...
Nisa Kirani's user avatar
8 votes
1 answer
3k views

Jetpack Compose Sending Result Back with SavedStateHandle does not work with SavedStateHandle injected in ViewModel

Sending Result Back with SavedStateHandle does not work with SavedStateHandle injected in ViewModel. Getting result using navController.currentBackStackEntry?.savedStateHandle? it works! fun ...
Malik Bilal's user avatar
  • 1,041
0 votes
1 answer
615 views

How to create 1 viewmodel with savedstatehandle for multiple chips?

I am trying to understand SavedstateHandle and how I can create 1 viewModel that can store multiple Chips using savedstatehandle. At the moment, whenever the user launches an onClickEvent on one of ...
Josef M's user avatar
  • 384
0 votes
1 answer
348 views

How to change the model parameter saving location when training with DefaultTrainer in detectron2

my code is like following: cfg = get_cfg() ... trainer = DefaultTrainer(cfg) trainer.resume_or_load(resume=False) trainer.train() After training, the model is automatically saved in./output/...
jianfeng cai's user avatar
11 votes
0 answers
668 views

Is SavedStateHandle in ViewModel and currentBackStackEntry the same?

I want to pass some data using savedStateHandle from activity straight to fragment's viewModel. In my activity I have: navController.addOnDestinationChangedListener { controller, _, _ -> ...
user3119685's user avatar
0 votes
1 answer
2k views

Re-setting learning rate while training in Pytorch

I am training a model using Learning Rate Scheduler in Pytorch to decrease the value of learning rate. By using learning rate scheduler, I reduced learning rate from 0.0001 to 1e-5, and save all the ...
killermama98's user avatar
0 votes
1 answer
90 views

How to benefit on "warm start" from the saved instance state bundle passed into onCreate() or onRestoreInstanceState()

After reading these Android documents, we feel confused about how to benefit on "warm start issue" from the saved instance state bundle passed into onCreate() or onRestoreInstanceState((). ...
Fisher's user avatar
  • 509
3 votes
2 answers
5k views

savedStateHandle not saving State

Following this question I made some simple changes in my app, but it's no working as I expect. I have a Timer that sends a notification when the timer is done. Clicking this notification restarts the ...
Ariel Di Pietro's user avatar
2 votes
0 answers
715 views

How to make viewModel lifecycle work for AndroidX-Lifecycle-viewModel-SavedState (with Jetpack Compose)?

My setup (relevant subset): Android Gradle Plugin 7.1.2 androidx.lifecycle:lifecycle-viewmodel-savedstate 2.4.1 androidx.activity:activity-compose 1.4.0 androidx.compose.* 1.2.0-alpha04 androidx....
Alix's user avatar
  • 2,777
1 vote
1 answer
133 views

How can we combine SavedStateHandler with LiveData Coroutine Builder?

In a typical Android ViewModel, we can easily create a Restorable LiveData using val liveData = savedStateHandle.getLiveData<String>("SomeKey") Whenever the liveData value is set, it ...
Elye's user avatar
  • 58.5k
0 votes
1 answer
263 views

Configuration Changes Not Save App State MVVM

I am building a movie app. There is a recyclerview matching parent size,and 1 search action button(SearchView). When I search for a movie,everything is working fine,but when I change orientation,the ...
HoLoGram's user avatar
  • 169
1 vote
1 answer
220 views

How to create a non-nullable LiveData that can save state

When we have a liveData as below, we cannot _liveData.value++, as the value is nullable. class MainViewModel(savedStateHandle: SavedStateHandle): ViewModel() { private val _liveData: ...
Elye's user avatar
  • 58.5k
1 vote
0 answers
520 views

Where and how is SavedStateHandle data stored on disk?

When saving part of the UI state using SavedStateHandle, the data in the state is persisted (on disk) on app process death. For various domain/business reasons, this data might contain sensitive ...
Erik's user avatar
  • 4,503

15 30 50 per page