Skip to content Skip to sidebar Skip to footer

Android Livedata List Not Updating

I am using Android LiveData and Room Database to update a list. I have a list of notes which have a tick to mark them as 'DONE'. If they are marked done, I remove them from current

Solution 1:

Your LiveData is responsible for reacting to Room database change only. If you want to change the list you need to create separate list or live data copy. Overall it is bad practice and LiveData+Room is used only for database change not memory instance. Imagine your LiveData object like a wrap over Room database.

Solution 2:

Your notes probably don't update themselves because your activity didn't change state. In that case you should update UI of changed note in your checkbox listener

From documentation:

LiveData takes in an observer and notifies it about data changes only when it is in STARTED or RESUMED state.

Post a Comment for "Android Livedata List Not Updating"