In previous chapters, we have been using Android-based constructs such as Loader
and AsyncTask
to offload work from the main thread to low priority background threads.
Although these straightforward constructs are able to deliver results that require intensive IO operations or network data, they don't provide out-of-the-box solutions for exception handling, task composition, and asynchronous event processing.
Beyond that, the popular AsyncTask
construct is not able to deal with Activity
or fragment configuration changes or cache results between configuration changes. Therefore, to cope with these kinds of problem, most of time the developer ends up creating a lot of extra code and complicated flows to handle the traits of these simple constructs.
To simplify the development of composable asynchronous work, we will introduce you to RxJava
, a functional framework that allow us to observe, transform, filter, and react to streams of events (click...