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.

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

Source: http://en.wikipedia.org/wiki/View_model

4827 questions
1
vote
0 answers

How to search a related property of a model via search view model

I am new to MVC and view models.I have trouble generating a LINQ search query on a related property of my search model. Here is my model of MaterialRequestMaster in domain layer: public class MaterialRequestMaster : BaseDomain { public…
Kasra H.
  • 25
  • 4
1
vote
0 answers

reuse viewmodel using hiltviewmodel

I'm trying to reuse compose function and viewmodel in different place. I can reuse compose function, however, I don't know how to reuse viewmodel. how can I reuse? @Composable fun SaveView(saveViewModel: SaveViewModel = hiltViewModel()) { …
1
vote
2 answers

How to use Android LifecycleOwner in dialog

I want to use mvvm in Dialog but I don't know how to pass LifecycleOwner to observe class CommonDialog(context: Context) : Dialog(context, R.style.AppMaskStatusTheme) { private val viewBinding: DialogSportOrderBinding by lazy {…
GHH
  • 1,713
  • 1
  • 8
  • 21
1
vote
1 answer

MutableLiveData value not updating confusion?

Working on a project in Kotlin in AndroidStudio, fairly basic stuff, but MutableLiveData is not working like I expect it to. Am I doing something wrong or maybe I'm confused on how it works? I'm using a viewModel to handle the LiveData and for…
1
vote
1 answer

What is the useEffect correspondent in android compose component

I have a master-detail app for android using kotlin and jetpack compose components. The flow in the app should be: Open app The app starts in the master view with a list having all items that were retrieved from a api using a view model. When an…
1
vote
1 answer

Android App pass data from ViewModel to ViewModel

I have a restaurant app with two main fragments each with their own viewmodels - LiveList fragment & viewmodel that retrieves a list of restaurants from the internet and displays them in a recyclerView. SavedList fragment & viewmodel that displays…
1
vote
0 answers

Can't insert into room database because of var initialization Android

I'm trying to make an Android application using Kotlin, Room Database and both view model and view model factory. The issue is that when I try to create the object of the entity I am trying to insert, I just get this warning (which i think in this…
1
vote
0 answers

Kotlin viewmodel- connecter value returns null

my connecter: interface SettingsVMRepConnector { fun getUserEmail(email: String) } in my viewmodel: class MyViewModel: ViewModel(), SettingsVMRepConnector { private val repository= SettingsRepository(this) private var inputUserEmail=…
1
vote
1 answer

how can pass api parameter in body instead @Query tag android kotlin retrofit

how can pass api parameter in body instead @Query tag android kotlin retrofit i want pass parameter in body instead api @Query my api interface @Multipart @POST("add_passport.php") suspend fun addPassport( @Part image: MultipartBody.Part?, …
androi useru
  • 81
  • 10
1
vote
1 answer

How can upload image from file path to server retrofit kotlin android

How can upload image from file path to server retrofit Kotlin android api interface @Multipart @POST("add_passport.php") suspend fun addPassport( @Part("userid") userid: String, @Part("fistname") fistname:String, @Part("surname")…
androi useru
  • 81
  • 10
1
vote
1 answer

Using viewModel as the single source of truth in jetpack compose

let's say we have a viewModel that has a value called apiKey inside. Contents of this value is received from DataStore in form of a Flow and then, it is exposed as LiveData. On the other hand we have a Fragment called SettingsFragment, and we are…
1
vote
1 answer

SwitfUI Published on static property

I have a View Model defined as such: class MyViewModel: ObservableObject { @Published public var logs: String = "" } I would like to modify the logs property from the global scope of my Swift code without initializing MyViewModel like…
Jasjeev
  • 385
  • 1
  • 4
  • 17
1
vote
1 answer

Save MVC dropdownlist item in database using ViewModel

I am completely new to the MVC architecure and need help with saving a dropdownlist chosen item in a database. Basically for every Project Model on its Create View I need to have a Dropdown list in which I need to pick an istance of Client (Name of…
1
vote
2 answers

Instantiate viewModel with run-time arguments using Hilt

What I'm doing I'm implementing oauth2 process to my android app. After user authorized the app via browser, my app will launch an activity to retrive the authorization code from intent, and then use the code to get the access token for APIs. I have…
1
vote
0 answers

Flutter - How to test page navigation when using a viewmodel with Provider

I am trying to write widget tests for my Flutter application. I have a page (MainMenuScreen) as follows (I've left out the imports): class MainMenuScreen extends StatefulWidget { @override _MainMenuScreenState createState() =>…
greysqrl
  • 937
  • 3
  • 13
  • 31
1 2 3
99
100