DEV Community

Discussion on: ✅[FIXED]✅ 🗄 Android Room Database is not sending updates upon returning to a Fragment 😥

Collapse
 
technoplato profile image
Michael Lustig - halfjew22@gmail.com

Why do you say of course they won’t be updated? You can see in the video they are being updated. Afaik the key different between Flowable and Observable is that the former has built in back pressure support, which really isn’t relevant to me.

I actually fixed it by changing the LifecycleProvider in the ShowsFragment from this to activity!! See the linked SO answer for the updated code.

Collapse
 
funkymuse profile image
FunkyMuse

Flowable isn't only backpressure related, it constantly emits a flow when the observe is present.

On attach isn't the best place to initiate the view model, onViewCreated is where it should be moved to.

Thread Thread
 
technoplato profile image
Michael Lustig - halfjew22@gmail.com

How is Flowable different than Observable in terms of what you’ve described?

Since this particular ViewMode is a singleton, I’m just getting a reference to it rather than instantiating it, so it shouldn’t matter much where that actually happens.