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

Trampoline

Trampoline is a Scheduler that executes code on the current thread. The way it works is that it adds a code block that will be executed to a queue of the current thread.

If it is used on .observeOn() and .subscribeOn(), it doesn't change the default behavior of the Observable and, thus, it is basically a No-Operation (NOOP).

It is mostly reserved for advanced use when creating custom Observables. An example where Trampoline could be used is to help avoid StackOverflow exceptions when calling recursive code.

Finally, if there is really a need for it, and a developer knows it's something that he really needs, it can be created with a call to Schedulers.trampoline().

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