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
1 answer

How to set MainViewModel?

I have my MainActivity where there are the movie with their poster. If I click on a poster (in the layout there are 4 ImageView) I can read the plot (a TextView) that is in the Fragment. If I open my app with the emulator MainActivity and Fragment…
user18082994
1
vote
0 answers

Single shared viewmodel for fragments in viewpager2 or nested viewmodels (one parent and one child-viewmodel pr fragment)?

I have a main fragment with a map, and below the map is a viewpager2 with several tabs/fragments. The tabs show different information depending on user location. I see 2 possible designs: One single shared viewmodel with all the data-logic. It's…
1
vote
1 answer

ASP.NET MVC Selecting value from dropdownlist

I have next model (simplified): public class CarType { public int Id { get; set; } [Required] public string Name { get; set; } } public class Car { [Required] public string Model { get; set; } [Required] public CarType…
kyrylomyr
  • 12,192
  • 8
  • 52
  • 79
1
vote
2 answers

How to add Items to RecyclerView using a ViewModel Android Kotlin

I have a fragment in which a RecyclerView is initialized. In the same fragment, I add elements to this RecyclerView. Code below: private lateinit var profileMenuList: MutableList override fun onCreateView( inflater:…
1
vote
2 answers

C# - Concurrent I/O operations exception

I have a refresh button to update news in my WP7 application. When I double or triple click on the refresh button I am getting an error "WebClient does not support concurrent I/O operations" . I think thats because It is sending the request triple…
FrankCap
  • 63
  • 6
1
vote
1 answer

How to call viewmodel dynamically with difference params with jetpack compose?

At the first time running, these code was working properly. Showing the data from the firestore with default parameter. But if I change parameter based on selectedDropdown no data is retrieved. I use modelFactory Here my MainActivity class Column()…
ltvie
  • 931
  • 4
  • 19
  • 48
1
vote
2 answers

Cannot create instance of MainViewModel - has no zero argument constructor with Compose Hilt

Using Jetpack Compose to build small Room database app. I keep getting error: Cannot create an instance of class com.learning.kotlinreadexstingroomdb.MainViewModel ... Caused by: java.lang.InstantiationException:…
SqueezeOJ
  • 441
  • 7
  • 17
1
vote
0 answers

using Viewmodel in service class with UI

I am working on a custom keyboard app that uses Inputmethod service class and has the keyboard UI. As I have read on a comment in Github " ViewModel should be used closely with an Activity or a Fragment".…
Raju Pathak
  • 55
  • 1
  • 5
1
vote
1 answer

MVC - @Html.DropDownList not storing user selection

I'm really new to programming and I'm trying to create a website in MVC where there's a list of movies. Rather than having the user scrolling through every movie there is, they can simply click on a drop-down filter and choose a letter. e.g. the…
ITN00bs
  • 55
  • 1
  • 6
1
vote
1 answer

WPF: Instantiating a new window/dialog causes >unrelated< list binding to stop updating

SOLVED My problem is a little weird and i'm not even sure why opening a window should have any effect at all on my list binding, so little hard to explain, so here is a video showing what happens: https://www.youtube.com/watch?v=bZ03l8OHEY4 I have 2…
morknox
  • 87
  • 8
1
vote
1 answer

The expression cannot be inverted, to be used in a two-way binding in EditText error

It is my first time using data binding, so I'm confused. Trying to implement two-way databinding in EditText with MVVM architecture and getting this error in my Build: The expression 'viewmodelClientUrl.getValue()' cannot be inverted, so it cannot…
flex
  • 37
  • 6
1
vote
0 answers

Reading and showing data from multiple tables

I'm trying to create a little asset management application, like an inventory. There are asset types (like notebook, mobile phone, desk, dishwasher etc.) and assets (like notebook-001, mobile-010 etc.). So this is my AssetType model: public class…
1
vote
0 answers

Getting NullPointerException while trying to mock view model in android instrumentation test

Here's the crash log java.lang.NullPointerException: Null reference used for synchronization (monitor-enter) at androidx.lifecycle.ViewModel.setTagIfAbsent(ViewModel.java:156) at…
sanket vetkoli
  • 826
  • 14
  • 18
1
vote
2 answers

Is it Possible to execute two LINQ queries of different types at the same time?

I have two models of Material Requests and Security Users : public class MaterialRequestMaster : BaseDomain { public string RequestCode { get; private set; } public string Description { get; private set; } public…
1
vote
2 answers

Use viewmodel for a fragment called twice

I have a navigation as follows: FragmentList -> FragmentDetailA -> FragmentDetailB -> FragmentDetailC I use a viewModel for the detail FragmentDetailViewModel private val detailViewModel: DetailViewModel by activityViewModels() But if I go forward,…
Patrick
  • 1,629
  • 5
  • 23
  • 44
1 2 3
99
100