AsyncHttpClient client = new AsyncHttpClient();
RequestParams params = new RequestParams();
params.put("username", username);
params.put("password", password);
client.post("192.168.12.4/administration/include/login.php", params, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(String response) {
System.out.println("onSuccess");
Toast.makeText(getApplicationContext(), "MySQL DB has been informed about Sync activity", Toast.LENGTH_LONG).show();
}
@Override
public void onFailure(int statusCode, Throwable error, String content) {
System.out.println("onFailure");
Toast.makeText(getApplicationContext(), "Error Occured", Toast.LENGTH_LONG).show();
}
});
如果我有以上這可能會使它的代碼去public void onFailure(int statusCode, Throwable error, String content) {}
而不是public void onSuccess(String response) {}
新AsyncHttpResponseHandler()總是要失敗
哪裏192.168.12.4
是在本地主機正在運行,並且在計算機的IP該項目包含的內容是login.php
所在位置
本地主機只適用於微粒PC我猜。它希望能夠在您的設備上訪問。 –
如果是本地主機,則在仿真器中運行。 – Piyush
'statusCode','error'和'content'的值是什麼? –