Home > OS >  How to make sure a database operation is completed before navigating to a different fragment
How to make sure a database operation is completed before navigating to a different fragment

Time:08-01

I'm learning more about RxJava (I know more about retrofit, but the company I work for does not use that unfortunately for me), and I'm trying to create a simple project with the room library and the enter image description here

CodePudding user response:

You could use Completable() or Single() to make sure insertion is completed. If you want to do navigation in the background thread, you can use handler and runOnUiThread but using some observable data holder like LiveData and observing it from view is a better solution.

  • Related