viewmodel Questions
1
Solved
In the codeLabs tutorial (Android - Kotlin - Room with a View), they have used "viewModelScope.launch(Dispatchers.IO)" to call insert method. what exactly it is and why is it used for.
Refer the li...
1
Solved
If I had to create some sort of API with a MVC architechture, I would have to decide a naming convention for DTOs that the controller receive and those DTOs that the controller produces I'm r...
8
Solved
I noticed that I have views that need the same information like others. But sometimes you need 5 properties of the view model and sometimes only 2.
Do you share such view model over many views or...
Coercive asked 30/8, 2012 at 21:19
1
Solved
I'm seeking the best way to observe data in ViewModel.
I'm using MVVM + DataBinding.
Repository:
private val data = MutableLiveData<String>()
suspend fun getData(): LiveData<String> {
...
Monteux asked 8/7, 2020 at 11:31
2
I'm following an example of google, the example is in java but when I rewrite it in kotlin I can not instantiate the class.
I am learning viewmodel. I have a lot of doubt if I messed up the syntax ...
Atrophied asked 21/6, 2018 at 12:50
2
So, I am using Koin for dependency injection, Here is what I did inside a activity
class ModuleDetailActivity : AppCompatActivity() {
private lateinit var moduleId:String
private lateinit var l...
1
I have just started using MVVM in android using kotlin. I have created an Android Service which is just fetching user location. This service runs constantly on background and uses FusedLocationApi ...
Stenger asked 7/12, 2018 at 17:57
1
Solved
class MyViewModel : ViewModel() {
private val users: MutableLiveData<List<User>> by lazy {
MutableLiveData().also {
loadUsers()
}
}
fun getUsers(): LiveData<List<User>&g...
3
Solved
I am using only dagger2 (not dagger-android) in my project. It's working fine to inject the ViewModel using multibinding. But there's one problem with that previously without dagger2 I was using th...
Hohenlinden asked 23/5, 2020 at 13:27
3
I am using the Navigation Component of Android Jetpack (2.2.0-alpha01).
I wish to use a child NavHostFragment nested inside my main NavHostFragment, equipped with its own child nav graph. Please vi...
Finder asked 31/8, 2019 at 19:18
2
I'm new to LiveData and I've been doing some tests lately. I have an app where I need to display data that can be filtered (name, category, date...). The filters can be combined too (name + date). ...
Bagehot asked 9/5, 2020 at 8:57
1
Solved
I've recently started working on Android architecture components. I found MVVM architecture to be extremely handy, and I would like to master it. When designing my apps, should I be using mul...
Akan asked 14/5, 2020 at 7:21
3
Solved
Trying to understand what is the difference with using the ViewModel to keep some of the state of the activity or fragment, and saving them with the savedInstanceState bundle.
Got a impression th...
Faubourg asked 4/8, 2017 at 14:19
14
Solved
Hey I'm trying to get my ViewModel working, but no luck so far.
Android Studio shows error Cannot resolve symbol 'ViewModelProviders'.
Every other question I found on this topic was correcting e...
Nicolella asked 21/3, 2018 at 11:50
2
Solved
I have multiple videos displayed they are bound with a videocollection in Mainviewmodel. Everything works fine untill I try to bind the enter command to Mainviewmodel. I Don't know the syntax for t...
Pentosan asked 15/8, 2013 at 3:32
1
I just started an Android App and I want to use ViewModel. I looked into documentation and I put all the dependencies from Lifecycle but when i try to instantiate a view model like this viewM...
2
Solved
When working with Bottom Sheets and Dialog how to perform operation:
Use a SharedViewModel with fragment that created this bottom sheet?
Don't use a ViewModel at all?
Creating a separate ViewMode...
Tiphane asked 29/4, 2020 at 6:46
3
Solved
I'm currently trying to share data between my two fragments with the help of a view model Android ViewModels.
In the this article they use "ViewModelProviders.of(getActivity()).get(SharedViewMode...
Amaliaamalie asked 10/3, 2018 at 14:26
1
I'm trying to use android two-way databinding with checkBox in a fragment.
I have multiple fragments in viewPager with custom FragmentStatePagerAdapter and one viewModel in first fragment.
I have a...
Holmberg asked 6/3, 2018 at 6:15
2
My app is a basic news app which fetches data from JSON provided by Guardian API.
I parsed the values from JSON using raw java code (not using retrofit).
Then I get the LiveData in NewsFeedViewMod...
Abominable asked 25/11, 2018 at 13:13
2
Solved
I am trying to find out in the code below, why is it that Room's LiveData observable does not give me new shifts once I populate the database with new data.
This is put on my activity's onCreate m...
Painting asked 25/6, 2017 at 1:41
1
Solved
I have the following ViewModel setup:
interface FooViewModel {}
class FooViewModelImpl: ViewModel(), FooViewModel {}
and I want to provide it via Koin like this:
viewModel<FooViewModel> ...
3
Solved
I have a SwiftUI (Beta 5) view with an attached ViewModel. I want to navigate to it via a navigationLink and pass in a simple parameter (called FSAC in this case)
I navigate using
NavigationLink(&q...
5
Solved
I'm using the S#arp Architecture. I can't remember where I read it, but I understand that view models should be stored at the service layer, and your views should submit the view model to the servi...
Fuqua asked 27/4, 2010 at 9:34
3
Solved
I saw two classes with a similar name, ViewModelProviders, and ViewModelProvider. Can anyone explain what are the difference between these classes? which class actually provide the ViewModel?
© 2022 - 2024 — McMap. All rights reserved.