use of com.lidroid.xutils.HttpUtils in project xUtils by wyouflf.
the class HttpFragment method testGet.
//@OnClick(R.id.download_btn)
public void testGet(View view) {
//RequestParams params = new RequestParams();
//params.addHeader("name", "value");
//params.addQueryStringParameter("name", "value");
HttpUtils http = new HttpUtils();
http.configCurrentHttpCacheExpiry(1000 * 10);
http.send(HttpRequest.HttpMethod.GET, "http://www.baidu.com", //params,
new RequestCallBack<String>() {
@Override
public void onStart() {
resultText.setText("conn...");
}
@Override
public void onLoading(long total, long current, boolean isUploading) {
resultText.setText(current + "/" + total);
}
@Override
public void onSuccess(ResponseInfo<String> responseInfo) {
resultText.setText("response:" + responseInfo.result);
}
@Override
public void onFailure(HttpException error, String msg) {
resultText.setText(msg);
}
});
}
Aggregations