//生成一个请求对象
HttpGet httpGet = new HttpGet("http://www.baidu.com");
//生成一个http客户端对象
HttpClient httpClient = new DefaultHttpClient();
//客户端向服务器发送请求,返回一个响应对象
HttpResponse httpResponse = httpClient.execute(httpGet);
//根据响应得到实体内容
HttpEntity entity = httpResponse.getEntity();
//使用IO流得到数据
InputStream inputStream = entity.getContent();
***注意:android sdk4.0不支持在主线程实现以上代码,需要创建新线程