Very rarely, a modern mobile application can be created without communicating with external resources over the network. The Reactive Stocks application is no exception as it is not possible to get financial stock information without an external data source.
There are lots of libraries to handle network requests on Android (and especially HTTP) but in the author's subjective opinion, the best one yet is Retrofit.
Retrofit allows a developer to make any kind of HTTP request very easily. Also, it is readily pluggable into the RxJava framework.
This chapter will focus on such integration. We will use Retrofit to query remote financial stock data on Yahoo Finance and we will display that information in our app.
In short, the following topics will be covered in this chapter:
- How to set up necessary Retrofit dependencies and configure Proguard
- How to configure Retrofit interface objects to make simple HTTP GET requests
- How to parse JSON requests
- How to execute HTTP requests periodically using RxJava
- How to display returned data in Android UI