Http操作访问网络

 1 操作步骤:
 2 <1>
 3 生成请求对象
 4 HttpGet httpGet = new HttpGet("请求地址。。。。。");
 5 <2>
 6 生成客户端对象
 7 HttpClient httpClient = new DefaultHttpClient();
 8 <3>
 9 执行请求
10 HttpResponse httpResponse = httpClient.execute(httpGet);
11 <4>
12 接受响应
13 HttpEntity  httpEntity = httpResponse.getEntity();
14 <5>得到数据流
15 InputStream  inputStream = httpEntity.getContent();
16 注意:
17 要添加权限: <uses-permission android:name="android.permission.INTERNET" />

去瞧瞧:http://www.cnblogs.com/freeliver54/archive/2011/12/28/2304850.html

posted @ 2012-11-16 10:48  AZ_mxl  阅读(173)  评论(0)    收藏  举报