小白想学retrofit,但以前没引入过第三方框架,不知道怎么高,请具体说明从零开始每一步怎么操作
1.在build.gradle文件里引入Retrofit需要的版本com.squareup.retrofit:retrofit:1.9.0,当然,如果了解RxJava和RxAndroid的童鞋也可以引入 io.reactivex:rxjava:1.0.14 、io.reactivex:rxandroid:1.0.1,配合Retrofit使用会更加好用。
2.实现Callback接口
3.封装请求的载体
4.定义请求接口和发起请求
http://blog.csdn.net/ljd2038/article/details/51046512
Retrofit没有想象中的那么难懂,只是和RxJava配合之后会有一些列不同的操作,建议你先草考一下官方示例,包含了Retrofit的常用用法,有不同的可以私信Me
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.squareup.retrofit2:retrofit:2.0.1'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
implementation 'com.jakewharton.rxbinding2:rxbinding:2.0.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.google.code.gson:gson:2.8.2'
配置就这配置 怎么用方法网上自己找