使用齐射发布值时发生服务器错误

时间:2015-08-18 09:15:54

标签: android-volley server-error

无法找到我的代码有什么问题,但是它给出了服务器错误,我尝试了很多方法,但仍然无法正常工作,如果我能找到错误,也许我可以解决它

    final String username=etUserName.getText().toString();
    final String password=etPass.getText().toString();
    String url = "http://192.168.3.63/survey/api/users";
    JsonObjectRequest postRequest = new JsonObjectRequest(Request.Method.POST, url,
            new Response.Listener<JSONObject>() {
                @Override
                public void onResponse(JSONObject response) {
                    Toast.makeText(getApplicationContext(), response.toString(), Toast.LENGTH_LONG).show();

                }
            },
            new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    Toast.makeText(getApplicationContext(), error.toString(), Toast.LENGTH_LONG).show();
                }
            }
    ) {
        @Override
        protected Map<String, String> getParams()
        {
            Map<String, String>  params = new HashMap<>();
            // the POST parameters:
            params.put("Name",username);
            params.put("Password",password);
            return params;
        }
    };
    Volley.newRequestQueue(this).add(postRequest);

0 个答案:

没有答案