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

Querying data

Let's glue all the pieces we have been creating until now to finally make that HTTP request and receive the stock data.

First of all, create an instance of the Retrofit service:

YahooService yahooService = new RetrofitYahooServiceFactory().create();

Next, define the parameters of the query:

String query = "select * from yahoo.finance.quote where symbol in ('YHOO','AAPL','GOOG','MSFT')";String env = "store://datatables.org/alltableswithkeys";

Lastly, create the subscription to the service query:

yahooService.yqlQuery(query, env)        .subscribeOn(Schedulers.io())        .observeOn(AndroidSchedulers.mainThread())        .subscribe(data -> log(          data.getQuery().getResults()          .getQuote().get(0).getSymbol())        );

After this request is executed, a ...

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