
操作步驟:
<1>
生成請求對象
HttpGet httpGet = new HttpGet("請求地址。。。。。");
<2>
生成客戶端對象
HttpClient httpClient = new DefaultHttpClient();
<3>
執行請求
HttpResponse httpResponse = httpClient.execute(httpGet);
<4>
接受響應
HttpEntity httpEntity = httpResponse.getEntity();
<5>得到數據流
InputStream inputStream = httpEntity.getContent();
注意:
要添加權限: <uses-permission android:name="android.permission.INTERNET" />
具體實現:
posted on 2012-03-23 17:54
mixer-a 閱讀(775)
評論(0) 編輯 收藏