基于Retrofit2.0实现
资源准备 导包:
首先我们需要在gradle文件中引入这两个包//版本要一致
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'io.reactivex:rxjava:1.1.0'
compile 'io.reactivex:rxandroid:1.1.0'
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.0-beta4'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.jakewharton:butterknife:7.0.1'
首先: 使用时要定义一个接口来返回我们数据
public interface RequestData {
// @FormUrlEncoded
// @POST("{url}")
// Observable