我試圖把一個網頁的HTML和我使用此代碼這樣做:HttpClient.execute總是給人異常
HttpClient httpClient = new DefaultHttpClient();
HttpContext localContext = new BasicHttpContext();
HttpGet httpGet = new HttpGet("http://www.google.com");
HttpResponse response;
try {
response = httpClient.execute(httpGet, localContext);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
,並始終在response = httpClient.execute(httpGet, localContext);
它給我的異常,也是我試過其他代碼
哪個異常,哪些是輸出(堆棧跟蹤,錯誤消息)? – hage
您可以發佈您在LogCat中看到的錯誤消息嗎? – TofferJ
java.net.UnknownHostException:www.google.com – MTA