Hi guys. I have a question, why my data will upda...
# android
a
Hi guys. I have a question, why my data will update and display on the RecyclerView in real-time even though my code does not consist of
observe()
to observe the ViewModel? I bit confuse.
d
Hi @Ayden, can you share a snipped of the code showing how you set up the RecyclerView?
a
Hi Daniel.
I place my entire code in this Pastebin. https://pastebin.com/wgxR3Ha2
d
Can I see your ViewModel?
Your main function calls initRecyclerView which calls displayQuotesList which observes quoteViewModel.allQuotes
a
Hi @Daniel This is my view model. https://pastebin.com/Nvx3aALJ
d
Hi @Ayden, Observables and LiveData are two different ways to do a similar thing. The function you provide to allQuotes.observe in displayQuotesList is called every time allQuotes changes because allQuotes is a LiveData. Does that make any sense?