前言
Retrofit是现在比较流行的网络请求框架,可以理解为okhttp的加强版,底层封装了Okhttp。
准确来说,Retrofit是一个RESTful的http网络请求框架的封装。
因为网络请求工作本质上是由okhttp来完成,而Retrofit负责网络请求接口的封装。
https://square.github.io/retrofit/
MutiPart
1 | import com.xhkjedu.zxs_android.model.ResultVo |
服务管理
1 | object ApiManager { |
调用示例
1 | fun uploadPic(filePath: String) { |
参数
1 | val file = File(filePath) |
Bitmap上传
我们获取的Bitmap要保存到本地才能上传
1 | import android.content.Context |