Reactive Everything: Long Operations
Explore how to convert long-running Android tasks into reactive operations using RxJava. This lesson teaches you to wrap blocking processes like file writes or network calls into Observables and Completables, ensuring they execute off the main thread. Understand how this approach simplifies error handling and improves app responsiveness without extra thread management.
We'll cover the following...
Let’s make everything reactive
From the previous examples, we’ve seen that we can wrap any object in an Observable and jump between non-reactive and reactive states using .blockingX() operators. In addition, we can delay execution of an operation by wrapping it in a .fromCallable() or .defer() Observable creation method. Using these constructs, we can start converting areas of an Android app to be reactive.
Long operations
A good place to start using RxJava is whenever we have a process that takes a while to compute, for example, network calls, disk reads and writes, bitmap ...