```
public class OKhttpUtils {
private static final String TAG = "OKhttpUtils--";
private static OKhttpUtils oKhttpUtils;
private final OkHttpClient okHttpClient;
private final Handler myHandler;
public OKhttpUtils() {
//新建主线程的handler
myHandler = new Handler(Looper.getMainLooper());
okHttpClient = new OkHttpClient.Builder().addInterceptor(new MyInterceptor()).build();
}
public static OKhttpUtils getoKhttpUtils() {
if (oKhttpUtils == null) {
synchronized (OKhttpUtils.class) {
if (oKhttpUtils == null) {
return oKhttpUtils = new OKhttpUtils();
}
}
}
return oKhttpUtils;
}
//异步get
异步utils
最新推荐文章于 2021-08-06 16:06:34 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)