我有一個Android調用Web服務的方法,如下所述。httpclient.execute沒有給出結果既不例外
現在,當我的班級調用此方法時,我無法看到任何異常,只有到登錄後纔會出現System.out.println("entered into call service method 2");
。我可以看到在logcat 狀態response = httpclient.execute(httppost);
不工作,並且System.out.println("entered into call service method 3");
沒有顯示在logcat也沒有任何異常。 任何想法爲什麼這樣?如何解決它?
public void callService() throws Exception {
System.out.println("entered into call service method");
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://localhost:81/a.php");
HttpResponse response;
System.out.println("entered into call service method 1");
try{
System.out.println("entered into call service method 2");
**response = httpclient.execute(httppost);**
System.out.println("entered into call service method 3");
你能張貼的callService方法整個源? – varevarao
感謝他們工作的錯誤是使用10.0.2.2而不是本地主機如果使用模擬器 – munish