0
我嘗試使用this網站上的類來實現通過Web服務登錄的方式。每當我嘗試登錄我的測試程序時,我都會在登錄嘗試後設置輸出以「響應」。該程序停頓約一秒鐘,然後輸出一個空字符串。有什麼方法可以查看我的應用程序是否嘗試登錄?甚至成功連接到互聯網?我的應用程序未成功登錄到Web服務
下面的代碼片段:
private RestClient restClient = new RestClient("https://service....");
...
private void LoginCheck()
{
restClient.AddParam("username", username);
restClient.AddParam("password", userpass);
try {
restClient.Execute(RequestMethod.POST);
} catch (Exception e) {
e.printStackTrace();
}
String response = restClient.getResponse();
Toast.makeText(LoginActivity.this, response, Toast.LENGTH_SHORT).show();
}
您是否已將INTERNET權限添加到清單中? – 2012-02-06 18:02:19
是的。在我做完之後,程序在返回之前會暫停一會兒。 – CodePrimate 2012-02-06 20:40:49