use of com.prajna.dtboy.http.IGlobalResponseHandler in project android-sex-http by dtboy1995.
the class MainActivity method init.
// 注册该接收者
void init() {
// init the global cache
HTTPUtil.initHttpCache(this);
HTTPUtil.BASE_URL = "http://apistage.wenanle.com";
HTTPUtil.globalResponseHandler = new IGlobalResponseHandler() {
@Override
public void disconnected(Context context) {
Toast.makeText(context, "no networking!", Toast.LENGTH_SHORT).show();
}
@Override
public void fail(String response, Context context) {
Toast.makeText(context, "error happened!", Toast.LENGTH_SHORT).show();
}
};
HTTPUtil.globalRequestHandler = new IGlobalRequestHandler() {
@Override
public List<Header> addHeaders() {
List<Header> headers = new ArrayList<>();
headers.add(new BasicHeader("version", "1.0.2"));
// add ...
return headers;
}
};
}
Aggregations