您的位置:首页 > 理论基础 > 计算机网络

HTTPUTILS获取网络数据

2016-07-01 08:28 411 查看
private void initEvent(final int i, String path1) {

HttpUtils httpUtils = new HttpUtils();

httpUtils.configCurrentHttpCacheExpiry(0);

httpUtils.send(HttpMethod.GET, path1, new RequestCallBack<String>() {

@Override
public void onFailure(HttpException arg0, String arg1) {

}

@Override
public void onSuccess(ResponseInfo<String> arg0) {
String result = arg0.result;
try {
ByteArrayInputStream stream = new ByteArrayInputStream(
result.getBytes("utf-8"));
List<Bean> listb = pullXml(stream);
Message msg = new Message();
msg.obj = listb;
msg.arg1 = i;
handler.sendMessage(msg);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: