HttpUtils请求



	http=new HttpUtils();  
          
        // 设置请求参数的编码  
        RequestParams params=new RequestParams();   //默认编码UTF-8  
        params.addBodyParameter("act", "index");  
        params.addBodyParameter("op", "index");  
        //发送请求  
        http.send(HttpRequest.HttpMethod.POST, "http://www.iginwa.com/mobile/index.php", params, new RequestCallBack() {  
  
            @Override  
            public void onStart() {  
                // TODO Auto-generated method stub  
                super.onStart();  
            }  
              
            @Override  
            public void onLoading(long total, long current, boolean isUploading) {  
                // TODO Auto-generated method stub  
                super.onLoading(total, current, isUploading);  
            }  
              
            @Override  
            public void onSuccess(ResponseInfo responseInfo) {  
                // TODO Auto-generated method stub  
                   String result = responseInfo.result;
                list = new Gson().fromJson(result,new TypeToken>(){});
            }  
  
            @Override  
            public void onFailure(HttpException error, String msg) {  
                // TODO Auto-generated method stub  
                  
            }  
        });  


 
 

你可能感兴趣的:(HttpUtils请求)