// 通过网址获得信息
private void getData(String path) {
HttpUtils httpUtils = new HttpUtils();
// 配置当前网络缓存到期时间 (0秒内数据那缓存数据)默认60s
httpUtils.configCurrentHttpCacheExpiry(0);
// 开始连接,RequestCallBack<T>是得到的数据类型
httpUtils.send(HttpMethod.GET, path, new RequestCallBack<String>() {
@Override
public void onFailure(HttpException arg0, String arg1) {
}
@Override
public void onSuccess(ResponseInfo<String> arg0) {
Message msg=Message.obtain();
msg.obj=arg0.result;
mHandler.sendMessage(msg);
}
});
}
httputils用法
最新推荐文章于 2024-04-21 09:53:21 发布