Skip to main content
Filter by
Sorted by
Tagged with
Best practices
0 votes
2 replies
54 views

I am building a Jetpack Compose app that uses a Scaffold with a persistent bottom sheet. The main content of the Scaffold show Google Maps, and the bottom sheet shows a menu. I have a MapViewModel ...
Pawandeep Singh's user avatar
Best practices
0 votes
2 replies
51 views

I come from a MVVM in WPF background moving towards ASP.NET MVC. I have a model that is composed of another model called Message, like so: public class User { public int Id { get; set; } [...
92carmnad's user avatar
  • 172
0 votes
1 answer
85 views

Should I always initialize a viewmodel in the Activity, before onCreate() even, if it is needed later in the flow? I do not know and am concerned if initialization of all the viewmodels right at the ...
Sayan Basak's user avatar
1 vote
1 answer
81 views

I have a data stream coming from the server. The server does not provide any information about when the next piece of data will arrive. I have a Flow in my repository that emits data as it arrives. ...
Vivek Modi's user avatar
  • 7,859
0 votes
1 answer
51 views

To process the live data for signals, I defined following class SignalsViewModel and when I call the updateSignals function, it get stuck and doesn't run the next command. I create the ...
ShineStar's user avatar
1 vote
1 answer
150 views

I’m working on Android and I have some doubts about how to properly manage ViewModels depending on the type of UI I’m using (XML with Activities/Fragments vs Jetpack Compose). Currently, my main ...
Cristian Alexis Torres Zavala's user avatar
-6 votes
1 answer
129 views

I'm getting an Xcode error: Cannot find $loginVM in scope. I here's the simplified viewModel import Foundation import SwiftUI @Observable class LoginViewModel { var showApiAlert: Bool = false ...
jonathan3087's user avatar
1 vote
1 answer
118 views

I’m trying to bind the SelectedItem of a WPF TreeView to a property in my MainViewModel in a pure MVVM setup (no code-behind). Since TreeView.SelectedItem is not a dependency property, I created an ...
6EQUJ5HD209458b's user avatar
1 vote
1 answer
67 views

I have a composable which uses Canvas to draw tasks on a clock-like dial. The tasks are read from a ViewModel state, which in turn loads them from a database. The list of tasks varies depending on the ...
Joyce Opio's user avatar
0 votes
1 answer
55 views

I'm using Navigation Component + Hilt DI. I have a Navigation Destination Fragment which hosts a viewpager with 2 fixed fragments. What is the right way to Instantiate the ViewModels within those ...
rdias002's user avatar
  • 234
0 votes
1 answer
107 views

How do I access the button within a collection view to stop and start a timer on it? The sender is a UserItem but I want to change the button within the same collection view. XAML Code (Collection ...
Aeneas's user avatar
  • 280
0 votes
0 answers
83 views

I’m building a Jetpack Compose screen using an MVI pattern (ViewState / ViewEvent / ViewEffect) and Hilt for DI. I have a modal dialog with an input field for a name. The dialog’s composable looks ...
Saif M's user avatar
  • 586
1 vote
1 answer
68 views

In a GET action method, based in some condition, I need to either return the view, or redirect to another action method that receives a view model via POST. This second action method view is strongly ...
patsy2k's user avatar
  • 745
0 votes
1 answer
49 views

I create a class to draw random elements in a fragment, I need pass a list of elements already store in ROOM database with a Dao and Repository class. ViewModel has a simple function to get all data ...
Delek's user avatar
  • 53
0 votes
0 answers
102 views

I have an app using SceneKit in a SwiftUI framework, and I am trying to properly organise my views by defining a separate view for the interface panel as an ZStack overlay. I have moved the buttons (...
user23510612's user avatar
1 vote
1 answer
199 views

I am doing a JetPack Compose course and I am trying to run an example project showcasing use of ViewModel together with Hilt. @AndroidEntryPoint class MainActivity : ComponentActivity() { override ...
Cristi's user avatar
  • 778
0 votes
1 answer
64 views

I'm trying to run the example program at https://developer.android.com/kotlin/coroutines#examples-overview in Android Studio Iguana: import androidx.lifecycle.ViewModel import kotlinx.coroutines....
doru001's user avatar
1 vote
2 answers
57 views

Here my composable @Composable fun CounterScreen(viewModel: MyViewModel = viewModel()) { val uiState by viewModel.uiState.collectAsState() Column( modifier = Modifier.fillMaxSize(), ...
Turvy's user avatar
  • 1,062
5 votes
1 answer
236 views

I have a ViewModel that exposes a StateFlow representing the UI state of a book list: class BooksViewModel(private val getBooksUseCase: GetBooksUseCase) : ViewModel() { val booksState: Flow<...
Vivek Modi's user avatar
  • 7,859
3 votes
0 answers
283 views

State management in React Native is a well-debated topic, with Redux often being the default choice. However, for developers coming from native mobile development (Kotlin/Swift), Redux can feel ...
Nathan Fallet's user avatar
0 votes
0 answers
68 views

I want to write some UI tests for a Composable screen. I constantly facing the same error again and again. The viewmodel cannot be mocked, even though I have declared the viewmodel class as open. here ...
Nontas Papadopoulos's user avatar
1 vote
1 answer
102 views

Hello I am receiving the error in the title based off the following code: class MainViewModel (application: Application, private val savedStateHandle: SavedStateHandle) : AndroidViewModel(application){...
Gil Ong's user avatar
  • 99
1 vote
0 answers
67 views

I want to display a community toolkit popup from a view model. The type of popup I want is a message box where I can pass a string variable that is the message I want displayed. I followed this Learn ...
Bob Gatto's user avatar
  • 166
0 votes
0 answers
100 views

I would like to create a WPF class library based on a TreeView to visualize JSON strings. I define a JsonProperty DependencyProperty which I wan't to use to pass the JSON string. I'm able to get the ...
Ludovic Wagner's user avatar
0 votes
1 answer
61 views

TextField always get empty when I try to write in it. My ViewModel: class MyVM: ViewModel() { var name by mutableStateOf("") fun onNameChange(newString: String) { name = ...
Ajay Jaiswar's user avatar
0 votes
1 answer
107 views

I followed the steps from the accepted answer from this link.I did my "own implementation", but the command doesn't raise. Also, I did the same as the post said, but it didn't work. Here is ...
L_J's user avatar
  • 1
1 vote
0 answers
152 views

As the title suggests, I am trying to determine the best approach for implementing a shared ViewModel in a multimodule project. Here is the approach I currently use: In my app module, I have the ...
leonel Z's user avatar
1 vote
1 answer
132 views

I have a data class in my models library data class ExperiencesUiState( val experiencesItems: Result<List<Experiences>> = Result.success(emptyList()), val userMessages: List<String> =...
Ippokratis Karakotsoglou's user avatar
1 vote
0 answers
71 views

I set up latest Android studio and all is up to date. I want to add viewModel to the dependencies of the build gradle. All is now in this Version. dependencies { implementation(libs.androidx.core....
JoergSH's user avatar
  • 11
0 votes
2 answers
139 views

I am developing an application which needs a stopwatch. And I want to show the elapsed time using a textblock. My problem is, that the view is not updating, but I can use ICommands. Here I assign the ...
Barta's user avatar
  • 147
-1 votes
1 answer
70 views

I am developing a WPF app for my final university project (thesis). One of the goals is to be able to dynamically change the language of the UI. I suppose that it is not a very good idea to do it the ...
Denis Ivanov's user avatar
0 votes
1 answer
38 views

I have a BottomSheetDialogFragment containing a RecyclerView in my Android app. The data for the RecyclerView is being received one by one from a socket connection. I need to add these items to the ...
Ghazanfar Ateeb's user avatar
0 votes
1 answer
43 views

My application is going to get a new string from the ViewModel every few hours and show it to the user as a notification text. The problem is that I don't know how to get the string from the ViewModel ...
developer_petit's user avatar
0 votes
0 answers
73 views

I'm trying to display a popup y closmessage box that will automatically close. But what I would like to do is send that message box two parameters. The first is a string that is the actual message. ...
BobG's user avatar
  • 1
0 votes
0 answers
217 views

I have this compose code who works perfectly: val pagerVM = hiltViewModel( creationCallback = { factory: JourneySummaryPagerViewModel.Factory -> factory.create(selectedIndex.value) }...
Kevin ABRIOUX's user avatar
0 votes
0 answers
51 views

I'm trying to create a message box that would display varied messages and headers. So what I'm kind of looking for is a way to data bind the displayed label controls in the XAML file. Here's what I ...
Bob Gatto's user avatar
  • 166
1 vote
2 answers
147 views

I have two ViewModels that contain the same function. The function calls an interface/repository to retrieve data from a database, and the function then manipulates the data. It is my understanding ...
Andrew Payne's user avatar
3 votes
1 answer
96 views

I'm currently working on an application using Compose and Hilt, and occasionally (less than 10 times out of 1000 according to my automated tests), the order of calls to my ViewModel differs, leading ...
rolandl's user avatar
  • 1,907
0 votes
1 answer
27 views

i've been working on this assignment of mine. to make a unit test on a viewmodel. but the viewmodel actually fetch token from api. is making a dummy for the token right? also i have a problem to make ...
Charlie's user avatar
0 votes
1 answer
62 views

I am a bit new to MVVM, I have a complex model List<List<SomeClass>>, lets call it a board, I want to bind it to a canvas in WPF, the canvas should act as map of Rectangles each Rectangle ...
ycsvenom's user avatar
0 votes
1 answer
142 views

I have a fragment HomeFragment which is part of the app navigation graph. Within FragmentHome I have a viewpager with 3 fragment instances of same class ChildFragment. Each ChildFragment requires an ...
rdias002's user avatar
  • 234
0 votes
1 answer
52 views

I have an abstract class: abstract class MyFirstViewModel( private val firstParamArgs: FirstParamArgs, private val secondParam: SecondParam):ViewModel(),ActionHandler{ override fun handleAction(...
Monica's user avatar
  • 446
0 votes
0 answers
64 views

Let's assume I have two screens: Screen A Screen B. When I send a NavigationUiEvent.ShowScreenB to the NavigationModel, the NavigationModel emits that event into a SharedFlow. That flow is ...
Mackovich's user avatar
  • 3,659
1 vote
3 answers
313 views

How do I import androidx.lifecycle.viewmodel.compose.viewModel on Kotlin Multiplatform (iOS, web, desktop, Android)? Attempts: [versions] androidx-activityCompose = "1.10.0-alpha02" androidx-...
Samuel Marks's user avatar
  • 1,930
0 votes
1 answer
46 views

What I'm looking to do is create and write all my methods in my view model file, and only place code in the code-behind file for functions that are automatically generated like ...
Bob Gatto's user avatar
  • 166
0 votes
1 answer
39 views

I am trying to make a simple app that uses firestore, that just insert the token of devices and fetch the names corresponding to that token. When I tried to fetch "name" value , the flow in ...
Prakhar_Pathak's user avatar
1 vote
1 answer
266 views

I am migrating an application from View to Compose. The application was written in Java so I need to migrate the UI to Kotlin. I prefer to do it as gradually as possible so I'm leaving the ViewModel ...
Shaul's user avatar
  • 469
0 votes
1 answer
59 views

All the data comes from the server in bulk. I cannot influence its volume. Therefore, to reduce the number of requests, I store this data in a single ViewModel, which I share on all screens. I ...
pie's user avatar
  • 173
0 votes
1 answer
111 views

How can I fix the issue of StateFlow values not updating? The value of StateFlow is not assigned to the BoardRequestDto object. The latest value of StateFlow is not properly collected in the ...
Bumblebee's user avatar
1 vote
2 answers
81 views

I'm creating a website where you can Create an event for a game.I have a Create Page. The page has a GameID field when creating a new Event. I'm attempting to use a ViewModel so that I can display the ...
Jimmy Dictus's user avatar

1
2 3 4 5
100