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

Creating service

Finally, after we have initialized the Retrofit object, we can create Retrofit service objects:

public YahooService create() {    return retrofit.create(YahooService.class);}

This call will take the interface that we have created and turn it into a fully-functioning object using a bit of Java Reflection magic and proxies.

Now we are ready to start making requests. We have intentionally skipped the code of the YahooStockResult class as it will be covered in the next section.

When everything is put in place, this factory class will look as shown:

import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;import okhttp3.OkHttpClient;import okhttp3.logging.HttpLoggingInterceptor;import retrofit2.Retrofit;import ...

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