Skip to main content

Questions tagged [viewmodel]

A view model or viewpoints framework is a framework which defines a coherent set of views to be used in the construction of an architecture. A view is a representation of a whole system from the perspective of a related set of concerns.

-1 votes
0 answers
18 views

ViewModel in Android [closed]

Can we have a viewModel in android in a project having more than 200 lines of code or viewModel should have minimum number of lines of code? I am developing a camera app, in which, user have to take ...
Hanif Khan's user avatar
-1 votes
1 answer
24 views

where the creation point of the savedStateHandle[key, value] map?

first, sorry for my bad eng. https://github.com/google-developer-training/basic-android-kotlin-compose-training-inventory-app/tree/main using this app and https://developer.android.com/codelabs/basic-...
user26416798's user avatar
0 votes
0 answers
20 views

How do I test view models for Android? I've been struggling with this for over a week

I am trying to test view model classes for my app. They use viewModelScope.launch and when I run tests using Firebase emulator, data will sometimes go to Firebase and sometimes won't resulting in ...
user24160237's user avatar
0 votes
0 answers
24 views

LiveData is not updating its value on 2nd api call

I am fetching currency exchange rate by api call using retrofit and ViewModel concept.On launch of application I am able to get the latest data from the server but when I am trying to update the live ...
Diwakar Singh's user avatar
0 votes
2 answers
75 views

How to Reinitialize Singleton Pages and ViewModels on User Logout and Login in a MAUI Shell App?

Problem Description I am developing a MAUI app that utilizes Shell tabs alongside a login flow. Each tab’s page and corresponding ViewModel are registered as singletons. Upon the initial load, the ...
Zoltán's user avatar
  • 176
0 votes
0 answers
15 views

Need to share data from Main Activity with Fragments managed by NavController

I have a very simple main activity with some state that I need to share with fragments being managed by a DrawerLayout and NavigationView hosted in the main activity layout Can someone show a simple ...
user2556468's user avatar
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
46 views

Ui does not recompose upon updating the stateflow from the ViewModel

I can change my view model's internal state by calling redirection(verified with Log statements), but it doesn't have any effect on gUiState in my main composable. Why is that? The main composable ...
Alberto Soligo's user avatar
-1 votes
0 answers
32 views

Do I need to avoid custom view inits when using a stateobject which relies on passed information?

I have a multi-staged question. Scenario: I have a list of user posts, where the list contains only a small subset of information about each post given the size requirement to show a list. Each post ...
Runeaway3's user avatar
  • 1,419
0 votes
0 answers
29 views

java.lang.RuntimeException: Unable to start activity ComponentInfo{}: java.lang.reflect.InvocationTargetException

I am trying to use MVVM with Room DB in my android app but getting this exception on the splashActivity. It was working fine until i added viewmodel and observers class SplashActivity : ...
Sahar Batool's user avatar
1 vote
1 answer
27 views

How to access a viewmodel as a function argument?

Android Studio shows an error: Unresolved reference: abc I tried changing the view model name and how it is instantiated, e.g. val myViewModel5 by viewModels<MyViewModel>() class ...
Loliconaoquadrado's user avatar
1 vote
1 answer
35 views

How to pass a string to a view model upon initialization?

I have an iOS app with the following views: struct LoggedInUserView: View{ @ObservedObject var viewModel: LoggedInUserViewModel @StateObject var sharedPortionViewModel: SharedPortionViewModel(...
Runeaway3's user avatar
  • 1,419
0 votes
1 answer
31 views

What is the difference between UIPickerViewDataSource and UIPickerViewModel on Xamarin

When it comes down to UIPickerView, I've always used a UIPickerViewDataSource to fill my picker view with data. Recently I've found out that there is also an option to use a UIPickerViewModel, but I ...
Pavlos Mavris's user avatar
1 vote
1 answer
68 views

I cannot fetch the data from viewmodel in ASP.NET Core MVC. My values for "input-asp-for" looks null in my view. How can I fix this problem?

First Image Description Second Image Description When I go to the view, I see some input asp-for fields as null, even though they aren't null. In ViewModel, the reference from other models are given ...
Büşra Nur's user avatar
0 votes
1 answer
28 views

How to send ViewModel event on activity start in the ViewModel init function correctly?

I want a camera screen to open after the activity has been created. When I send an event triggering the camera in the ViewModel init function then nothing happens: The ViewModel init function: init{ ...
GrimPloughman's user avatar

15 30 50 per page
1
2 3 4 5
331