2012-09-24 97 views
0

我是新的android開發和日食Juno版本。我一直在嘗試使用xml解析。在調試執行行以檢索xml時,它會以下列錯誤結束。Xml響應檢索問題

// defaultHttpClient 
DefaultHttpClient httpClient = new DefaultHttpClient(); 
HttpPost httpPost = new HttpPost(url); 
//Below Line Shows the Source not found error. 
HttpResponse httpResponse = httpClient.execute(httpPost); 

錯誤:

Class File Editor 
Source not found 
The source attachment does not contain the source for the file DefaultRequestDirector.class. 

You can change the source attachment by clicking Change Attached source below: 

Change Attached Source... 

The source attachment does not contain the source for the file DefaultRequestDirector.class. 

但我可以看到DefaultRequestDirector.class在包的Android 4.1 ==> org.apache.http.impl.client。 嘗試使用Cmd + Shift + O組合鍵,並嘗試使用eclipse中的「Clean」選項,但最終出現同樣的問題。

我錯過了什麼嗎?

回答

0

嘗試下面的代碼...看看是否有幫助:

HttpClient httpclient = new DefaultHttpClient(); 
HttpConnectionParams.setConnectionTimeout(httpclient.getParams(), 10000); 
HttpPost httppost = new HttpPost(url); 
HttpResponse response = httpclient.execute(httppost); 
+0

沒辦法......同樣的錯誤.. –

+0

u能提供您完整code..I想看看你有什麼進口.. ?? –