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

Integrating Twitter status updates into the Flow

Now there are two sources from where the data is coming:

  • The periodic updates from Yahoo Financial Stocks
  • The constant stream of Twitter status updates

It is necessary to merge them into a single Observable so that we can make use of a single combined flow and reuse the code we already have to display them.

To merge two Observables, we will use the Observable.merge() function:

Observable.merge(        observable1,        observable2)

This Observable will return items of the StockUpdate type, so it means that the observable1 and observable2 will have to return the StockUpdate type as well.

In the place of observable1, we can move the code that is responsible for the periodic updates of financial stock ...

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