Questions tagged [viewmodel-savedstate]

38 questions
0
votes
1 answer

ASP.Netcore How to call model/ViewModel in another Controller like HomeIndexView

I have a model called, "GetInTouch" (contact us form) with its controller and view all works fine. My problem is that, when the app loads it has a 'Home/landing page' and I need to display this 'GetInTouch' view on the landing page which has a…
0
votes
1 answer

Just can't get SavedState on ViewModel working no matter what I try

Never mind. Apparently I had the wrong idea about what a SavedState is supposed to do. Leaving the post here so my foolishness is preserved for the ages. Been trying to get a ViewModel using a SavedStateModel working for ages now. Please tell me I'm…
Slashee the Cow
  • 315
  • 3
  • 8
0
votes
0 answers

get context SavedStateHandle Java Android

I want to get something from SharedPreferences in a ViewModel class. The constructor has a SavedStateHandle parameter only and I don't know how to get the context. Here is my code: public class PropertyDetailActivityViewModel extends ViewModel{ …
Pierre A
  • 15
  • 4
0
votes
1 answer

Why SavedStateHandle doesn't save or return my livedata?

I use Navigation Component and load data in a recyclerview (MVVM architecture so this fragment has a viewmodel) if I move to another fragment and then I navigate back to the fragment which has a viewmodel then the viewmodel livedata is empty but I…
0
votes
1 answer

How to inject SavedStateHandle to ViewModel in dynamic feature module?

Using @Assisted annotation with savedStateHandle and by viewModels() it's possible to inject SavedStateHandle object to ViewModel in modules that are not dynamic feature modules with dagger hilt as @AndroidEntryPoint class MainActivity :…
0
votes
1 answer

Viewmodel SavedStateHandle data lost after process death

I am trying to use savedStateHandle in my ViewModel and test it. My simple case is that I'm just storing an Int value in the SavedStateHandle and trying to get it again after the process death. But its not working at all. I am using the following…
Sundaravel
  • 464
  • 5
  • 16
0
votes
1 answer

How to convert ViewModel to utilize state saving?

I have a ViewModel I am currently using to contain data and share values between Fragments. This model also helps instantiate the data for the app on activity start. I am now trying to add in state saving functionality to my app, and I'm confused…
0
votes
0 answers

Retain EditText with Screen Rotation using Databinding Library

I have two classes AdminPinActivity.kt and AdminPinActivityPresenter.kt AdminPinActivity.kt: class AdminPinActivity : InjectableAppCompatActivity() { @Inject lateinit var adminPinActivityPresenter: AdminPinActivityPresenter private var…
1 2
3