I have a Room Database table with multiple columns (PartsTable). I need to fetch only one column from the table that contains one word String and I’m using a subset of a table as per google docs (PartsTuple). Now I need to create a function that will or something else that will return the ArrayList of fetched data, which I
Tag: android-livedata
Merging multiple LiveData sources?
To make it easier to visualize my problem I drew the following: I am using a RoomDatabase, a Repository, a Viewmodel and Livedata. Areas have a 1 to n relationship with Gateways and Gateways a 1 to n relationship with Items. I created both an AreaWithGateways entity and a GatewayWithItems entity. Items can move from a gateway to another, which
Toast message inside MutableLiveData.observe() working repeatedly
I have a register form and ı want to show a message to the user based on signed up successfully or not.I store that message in my view model which has a mutable live data object to store that message and observing that object from my activity.My problem is when ı click to the register button first time it works
Accessing BroadCastReceiver in Viewmodel
I am struggling in choosing the right way to pass data from broadcastReceiver to ViewModel and from there I pass data to my Repository and update LiveData. I use FCM push notifications and have local broadCastReceiver which uses ActivityLifecycle. I found that it is bad practice to access ViewModel from BroadcastReceiver, but not sure why? If I manage lifecycle of
Why LiveData setValue or PostValue triggers onChange just once in the view?
LiveData setValue should have triggered the onChanged method in the Activity, however it calls only at the first time, after when I try to make paging, it breaks and doesn’t call onChanged anymore, though my response is does successful and I see it in the log. What’s wrong with setValue/postValue? Is it a bug? Should I implement observer pattern on