首先导入Rxjava与Retrofit依赖
compile 'com.squareup.retrofit2:retrofit:2.1.0' compile 'com.squareup.retrofit2:converter-gson:2.1.0' compile 'com.squareup.retrofit2:converter-scalars:2.1.0' compile 'io.reactivex.rxjava2:rxandroid:2.0.1' compile 'io.reactivex.rxjava2:rxjava:2.1.0' compile 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
创建Service服务接口
public interface GetService { // http://gank.io/api/history/content/{1}/{1} @GET("content/{number}/{page}") Call<MyBean> getData(@Path("number") int n, @Path("page") int p); @GET(