现在有个需求是   当http连接很久时我需要设置一个连接超时   还有一个就是用户不想等 直接返回  这时就要关闭这个http请求
不知道那位大侠能帮帮小弟!
http  取消   取消http请求如何设置http连接超时android

解决方案 »

  1.   

    我的请求是这样看可不可以:
    String strResult=null;
    String httpUrl="your url";
    HttpGet httpRequest=new HttpGet(httpUrl);
    DefaultHttpClient defult=new DefaultHttpClient();
    HttpResponse httpResponse=defult.execute(httpRequest);
    if(httpResponse.getStatusLine().getStatusCode()==200){
       /*读取返回数据*/
       strResult=EntityUtils.toString(httpResponse.getEntity());
    }