LiveData which publicly exposes setValue(T) and postValue(T) method.
Questions tagged [mutablelivedata]
320 questions
1
vote
1 answer
Invoke MutableLiveData Observer without using postValue()
Suppose, I've a MutableLiveData. So if I update a variable in User let say userName using the value like
var user = MutableLiveData()
user.postValue(User())
user.value.userName = "ABC"
it won't call the observer. So I have to call a…

Ashutosh Sagar
- 981
- 8
- 20
1
vote
1 answer
Generic type in MutableLiveData in kotlin
I have a val _user: MutableLiveData>> = MutableLiveData()in viewmodel but i want to postValue errorException
// A generic class that contains data and status about loading this data.
sealed class Resource(
…

Mansukh Ahir
- 3,373
- 5
- 40
- 66
1
vote
2 answers
Convert ArrayList to MutableLiveData> in Kotlin
What i am trying to do is to convert the ArrayList to MutableLiveData> to be send as a return value. Though i am getting the ArrayList result correctly,i failed miserably in posting the value to…

Shijilal
- 2,175
- 10
- 32
- 55
1
vote
2 answers
MediatorLiveData This source was already added with the different observer in activity when navigate with onbackpressesed between activities
I have an ugly error with mediator live data... and I can´t understand the problem.
I have one activity A which asks for messages to the backend, when I come back from the background I always have to refresh again if there is data, then always call…

AnD
- 125
- 1
- 8
1
vote
0 answers
Dagger MutableLiveData Identifiers
I'm using Dagger Module to Inject MutableLiveData into my project
The problem is using different identifier for each MutableLiveData provider that returns the same object
@Module
public class LiveDataModule {
@Provides
public…

shady
- 11
- 1
1
vote
1 answer
Livedata is not triggered when List item is getting updated
I have a pretty straightforward question about LiveData. I have a MutableLiveData> and I want to update a specific field in my list, so I guess that when the field is updated, the MutableLiveData should trigger the observers but…

Konstantinos.T
- 93
- 1
- 11
1
vote
1 answer
Can MutableLiveData have a subclass as it's type?
I am having trouble with passing MutableLiveData as an argument when the parameter is MutableLiveData. The trouble being that my app won't build and I get a: DataBinderMapperImpl error: cannot find symbol.
This works:
fun…

Alex Barbag
- 21
- 2
1
vote
2 answers
How can I perform Transformations on MutableLiveData?
The docs show how you can perform Transformations on a LiveData object? How can I perform a transformation like map() and switchMap() on a MutableLiveData object instead?

Lobstw
- 489
- 3
- 18
1
vote
1 answer
Some of the multiple concurrent calls to set LiveData are not observed
I have a function to make network calls. It can be called multiple times at the same time and each call runs concurrently.
getDataTask() // it is subscribed on the background thread and observed on the main thread
.subscribe(
{ result ->…

Tartar
- 5,149
- 16
- 63
- 104
1
vote
0 answers
How to add paramaters to new livedata builder in the view model
I'm trying to convert my view models to use the new livedata builder from live data2.0
In all the examples i've seen when you use this new builder pattern they omit how to set parameters take this view model for example, userId is not defined
class…

Brian
- 4,328
- 13
- 58
- 103
1
vote
2 answers
Is there a better way to expose private MutableLiveData as LiveData for an ViewModel. [Android, Kotlin]
In the following example I want to expose a List of Int like this:
val test: LiveData
- >
get() = _test as LiveData
- >
private var _test = MutableLiveData(mutableListOf

Awa Kenzo
- 13
- 4
1
vote
1 answer
Type mismatch. Required: Observer Found:?
I want to Observe live data change in ViewModel and want to change another live data so I am using Mediatorlivedata, I don't know how to observe it in ViewModel, I am getting the compile-time error
Type mismatch. Required: Observer Found: ?
class…

creativecoder
- 1,470
- 1
- 14
- 23
1
vote
1 answer
How to make MutableLiveData to trigger onChanged?
Help me out please.
I want to observe some String using LiveData.
OnChanged() getting triggered once upon app start, but when Im changing the value of string1 by button click, onChange() does not trigger and information is not updated. TextView…

Waldmann
- 1,563
- 12
- 25
1
vote
2 answers
Android RecyclerView submitList not updating data in LiveData observer
I am trying to update my nested RecyclerView list using submitList in a LiveData Observer.
The list is submitted, but the UI only updates when you touch the screen.
The issue arose when I added nested RecyclerViews in my master RecyclerView.
So I…

Timmy1e
- 11
- 1
- 6
1
vote
0 answers
How to properly set A Retrofit response into a MutableLiveData so that it becomes observable
What I'm trying to do : I am trying to show a list of cities in a RecyclerView in the MainActivity and whenever a city in the list is clicked a WeatherDetailsActivity should fetch a response from the OpenWeather's API using Retrofit. I'm using MVVM…

SandyG
- 33
- 1
- 5