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

Using Transformation to debug Observables

One cool use case for transformations is to use them to print additional logging during the execution of the Observable. This can be really useful when what's happening inside the Observable flow is unclear. Sometimes the Observable can terminate abruptly with a regular onComplete() call, but you won't be able to find a reason why that is happening.

To help you debug cases like these, we can use a logging Transformer. In this section, we will create a tool for this--a logging Transformer.

Let's start by creating a class:

import io.reactivex.Observable;import io.reactivex.ObservableSource;import io.reactivex.ObservableTransformer;public class LoggerTransformer<R> implements ObservableTransformer< ...

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