标签:https bsp callback queue mode imp com end model
package com.test.mvp.mvpdemo.mvp.v4.model;
import com.test.mvp.mvpdemo.mvp.v4.MainContract;
import com.test.mvp.mvpdemo.mvp.v4.basemvp.BaseModel;
import okhttp3.Callback;
import okhttp3.OkHttpClient;
import okhttp3.Request;
/**
* model 层,请求网络或数据库,提供数据源(原始数据)
*/
public class DataModel extends BaseModel implements MainContract.IMainModel {
@Override
public void requestBaidu(Callback callback) {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://www.baidu.com/")
.build();
client.newCall(request).enqueue(callback);
}
}
---------------------
标签:https bsp callback queue mode imp com end model
原文地址:https://www.cnblogs.com/hyhy904/p/11299088.html