O'Reilly logo

Reactive Android Programming by Tadas Subonis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Android Scheduler

The last Scheduler that we will cover is the Android Scheduler from the rxandroid library. It's nothing new for the reader as we've already used it by calling this:

AndroidSchedulers.mainThread()

Its purpose is to return the execution of the code to the main thread of Android. It must always be used in cases when the computation was offloaded to some other Scheduler and the result that was returned must be shown in UI. As we already know, no UI modifications can be done on threads other than on the main Android thread.

In almost all cases, it will be used in .observeOn() calls as, usually, the main place where the UI modifications are handled are the .subscribe() blocks.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required