use of com.okhttplib.callback.Callback in project OkHttp3 by MrZhousf.
the class MainActivity method forceNetwork.
/**
* 仅网络请求
*/
private void forceNetwork() {
OkHttpUtil.Builder().setCacheType(CacheType.FORCE_NETWORK).build(this).doGetAsync(HttpInfo.Builder().setUrl(url).build(), new Callback() {
@Override
public void onSuccess(HttpInfo info) throws IOException {
String result = info.getRetDetail();
resultTV.setText("FORCE_NETWORK:" + result);
setFromCacheTV(info);
}
@Override
public void onFailure(HttpInfo info) throws IOException {
resultTV.setText("FORCE_NETWORK:" + info.getRetDetail());
}
});
needDeleteCache(true);
}
Aggregations