https://kotlinlang.org logo
#android-architecture
Title
# android-architecture
r

Rodri Represa

09/08/2020, 1:55 PM
Hey guys, I'm in doubt with Retrofit and coroutines. If I have a livedata which is returning my favourites films from and API and I observe this livedata and show the films in the screen. If I add a new film in my favourites, is the livedata going to emit this new film? Do I need to call the API again?
k

Khaleelfreeman

09/08/2020, 2:12 PM
You will need to call your API again if you want to ingest your new film. Whatever observes the livedata should react to this new film however you define e.g. updating a recyclerview adapter with the new item.
1
u

ursus

09/08/2020, 3:37 PM
or use some storage which emits its new state on change, like a database -- sqldelight/room
3 Views