Questions tagged [mutablelivedata]
LiveData which publicly exposes setValue(T) and postValue(T) method.
mutablelivedata
329
questions
0
votes
0
answers
26
views
MutableLivedata isn't triggered after first time
I have a list of categories and every category has subcategories and products.
when I launch the activity the data of subcategories and products are loaded in the UI correctly but when the user click ...
1
vote
0
answers
49
views
Why my fragment not observe change of livvedata in view model
i have a live data(isEquipmentTabEnabled) in a view model. i update it in fragment1 and i observe it in fragment2.
when i call update this from fragment1, update method in viewmodel call but then ...
0
votes
1
answer
87
views
After set targetSdk = 34, Activity in background can't receive update from foreground service
I have a Timer app. Use Foreground service to record time duration. This foreground service has a mutablelivedata that will postvalue when the countdown goes to zero. And in MainActiviy I observe this ...
0
votes
0
answers
63
views
TelephonyCallback.CallStateListener with LiveData and ViewModel
I'm new to both android and java, now im trying to update a textview with the state of the call, but the view model doesn't get the value from the telephony callback class.
Im using post value since ...
0
votes
2
answers
42
views
Multiple MutableLiveData change results in a single MutableLiveData
In my android project, I have three MutableLiveData variables. Upon the change of their values, I want to change the value of another MutableLiveData and observe its value to make an API call. Is the ...
0
votes
2
answers
104
views
mutableStateListOf is not updating it value on changing it
I have a todo app that reads to mutableStateListOf data from a view model. When Adding a todoItem it is working properly fine also by deleting it works fine state is getting updated by when I update ...
1
vote
0
answers
54
views
ViewModel function implementation with MutableLiveData or use directly a LiveData?
I have a function getAdressSuggestions who return a list of AddressResult
I wonder what is the best implementation between this two :
The first one is with a MutableLiveData we have inside the ...
0
votes
0
answers
29
views
MutableLiveData with ArrayList and ArrayAdapter
i am trying change my:
ArrayList<Worker> Workers = new ArrayList<Worker>();
to:
private MutableLiveData<ArrayList<Worker>> Workers = new MutableLiveData<>();
i built ...
0
votes
2
answers
101
views
How to use MutableLiveData and LiveData in Android?
I have used MutableLiveData and LiveData in the 3 ways below and see no difference.
// 1
private val _way1 = MutableLiveData<Boolean>()
val way1 get() = _way1
// 2
private ...
0
votes
0
answers
17
views
Kotlin How to share between 2 different activitiy's 2 different fragments
I'm trying to improve myself on kotlin but i have issues, like in the title i want to share data between 2 different activity's 2 different fragments but with livedata i cannot observe data from other ...
0
votes
1
answer
40
views
Updating MutableLiveData<ArrayList<User>>
Until now I have been changing User in MutableLiveData<ArrayList<User>> by deleting and adding User(with updated attributes)
Is there any other option to update a User in ArrayList of ...
0
votes
1
answer
46
views
mutableLiveData doesn't trigger recomposition when adding items to a list
i've got a list of bitmaps wrapped in a mutableLiveData in my viewModel, and i'm pulling bitmaps from an online database and adding them to the list as they arrive. for some reason, it isn't ...
0
votes
2
answers
75
views
Toast Message keeps appearing when orientation changes
So, I am trying to use the Event class for handling one-time events where if I make an API call in onCreate() of my activity and observe the view model's Livedata variable, I am showing a Toast ...
0
votes
0
answers
15
views
In Junit test, MutableLiveData value not updating after executing test
I am writing Junit tests for ViewModel, but mutableLiveData values are not update after test run and tests are failing.
View model has Dagger dependency injected class, hence I can not create ...
0
votes
1
answer
71
views
Diff util not updating items in recycler
I have problems updating data into recycler view. Im using adapter with diffutil
class DiffUtilCallback : DiffUtil.ItemCallback<SectorItemDataUI>() {
override fun areItemsTheSame(oldItem: ...