If you’ve used an AsyncTask before this code should look familiar. Inside the
doInBackground method I make a network request to some given URL, and return the result as a
Boolean. Then in
onPostExecute I could do something with that result.
There are many ways you could approach this in RxJava. But essentially all I’m doing is creating an Observable which reports on the result of the network request. I observe the result on the main thread (with RxAndroid) so I could make any UI changes. This is effectively the same as the AsyncTask I created. The main difference is that with an Observable I have much more flexibility in how results are processed.