一、引言
最近一直在学习Android框架,学习了Retrofit+Rxjava的简单使用特此纪录下。
二、导入依赖
//retrofit
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.4.0'
//rxjava
implementation 'io.reactivex.rxjava2:rxjava:2.1.17'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'

三、 Retrofit
创建一个接口:
ApiService:


四、 创建观察者

五、 总结
这只是Retrofit+Rxjava结合的走下大体流程,接下来几篇将详细的介绍Retrofit和Rxjava
网友评论