LiveData which publicly exposes setValue(T) and postValue(T) method.
Questions tagged [mutablelivedata]
320 questions
0
votes
0 answers
SQLite sort by position in a String [] , when that String [] is a field
I have a table like below in Room, in a Android application, I use Raw Query to get data. Can it be sorted by second value in array sorting_field?
---------------------------------------------
| id | other_fields | sorting_field …

Rares Serban
- 151
- 3
- 9
0
votes
1 answer
Android ViewModel with custom Model
I'm planning to have a model class and provide an instance of this model through an Android ViewModel. The instance in the ViewModel can change through the application lifecycle.
My current idea is like this:
public class Book {
private…

pck
- 203
- 2
- 10
0
votes
1 answer
How can I convert LiveData to 2 pieces of liveData?
I have configLiveData:LiveData> where Response is
sealed class Response {
data class Success(val data: T) : Response()
data class Failure(val message: String) : Response()
}
now in ViewModel I…

I.S
- 1,904
- 2
- 25
- 48
0
votes
1 answer
MutableLiveData won't trigger loadAfter to fetch from Android ROM using PagedList
I have 70 itens stored on my ROM and I would like to fetch a paged amount of 15. I read many posts so far with related issues, however none of them were useful for me.
Some possible causes for loadAfter not being triggered:
Solution 1 : call…

Victor Oliveira
- 3,293
- 7
- 47
- 77
0
votes
1 answer
LiveData of a list notifies observers without calling setValue or postValue
I have a MutableLiveData like this in my view model:
val liveData = MutableLiveData>()
I add the results from an endpoint call to this LiveData like this:
liveData.value?.addAll(myList)
as far as I know, MutableLiveData shouldn't…

Moh Mah
- 2,005
- 20
- 29
0
votes
1 answer
How to databind livedata object (android)
Today I've some question about mvvm and databinding on android,
I'm trying to bind object properties on view.
I've an Object (Model) with some properties, by example :
public String name;
public String title;
public int value;
I've a ViewModel with…

C. MARTIN
- 43
- 12
0
votes
1 answer
What is a good way to structure hierarchical data in LiveDatas for databinding purposes?
With databinding, how can I best structure data to localize UI redraw corresponding to just one small aspect of a larger LiveData?
My UI is a fragment representing a Workout with a collection of TableLayouts, each corresponding to a Group. The…

user1713450
- 1,307
- 7
- 18
0
votes
1 answer
Parceler: Unable to find read/write generator for type MutableLiveData in Android ViewModel
I'm getting a compilation build error when I add a MutableLiveData object to my view model in my Android Studio project. I'm not calling getUser() or setUser() anywhere yet and I added the exact same object to a different view model in my project…

Joe Galante
- 33
- 4
0
votes
1 answer
Room not returning duplicates
So I have a room database all set up, everything is fine, so I can make queries and inserts, delete etc no problems, however i've just run into a situation where id like to return entries by their Ids and duplicates should be allowed, however room…

martinseal1987
- 1,862
- 8
- 44
- 77
0
votes
1 answer
How to use a MutableLiveData Object in my xml?
I have an object that will fill some fields in my xml, but a mutablelivedata return a T value and I can't use the T properties. What I need to do to use the T object in my xml?
I don't want to create a mutablelivedata for each object member.
Sorry…

Breno Cruz
- 63
- 6
0
votes
1 answer
Using Livedata and having a problem with displaying MutableLiveData result
I am just testing ViewModel and LiveData of Android Architechture Components. I have this basic Activity with one EditText to receive a number from the user and when clicking the Convert button then the Textview should give the result multipled by…

barutto
- 104
- 1
- 14
0
votes
1 answer
Mediator Live data is not getting updated when retrofit response is changed
I am using MVVM architectural component in my app.The task is to add retrofit with MVVM.
I am calling the webserver in every 10s to get the response data . To update this value i am using Mediator live data .
This is code for it
public…

Ravi Parmar
- 23
- 4
0
votes
0 answers
Observer LiveData that have multiple async resources
How can we handle in case multiple data sources update value to the same LiveData and observed by the view?
If we only want the result from the last button that user click and because the network call may have latency and the final result that…

Jongz Puangput
- 5,527
- 10
- 58
- 96
0
votes
0 answers
How to detect android liveData state?
First of all, I am new in LiveData.
I found this from the android official website.
An exception to this behavior is that observers also receive an update
when they change from an inactive to an active state. Furthermore, if
the observer…

Sunny Sultan
- 1,090
- 15
- 20
0
votes
1 answer
Using LiveData in data binding instead of MutableLiveData
Hi I am using LiveData instead of MutableLiveData because I am getting LiveData from Room and it is working even after removing binding.setLifecycleOwner(this);. My question, is there any problem with that? Hope it helps to others

a0x2
- 1,995
- 1
- 18
- 26