发送邮件json请求使用齐射响应没有得到正确

时间:2016-10-11 10:07:44

标签: android json android-volley

我正在使用volley发送一个post json请求,因为我传递的json对象请求没有得到任何正确的响应。我找到了哪个地方有问题。我发送的参数是正确的。但响应不是come.kindly发送积极的反馈。

 Request:     {"first_name":"abdul","confirm_password":"nbnbnbnb","phone":"684888444","email":"dhjs@kjf.in","last_name":"sdfhj","devicetype":"1","devicetoken":"1","country_code":"+91","password":"nbnbnbnb","deviceid":"1"}

signurl=Utils.url+"mobileapi115/customerRegistration/dGF4aV9hbGw=/";
        signurl = signurl.trim().replaceAll("\\s+", "");
        System.out.println("reg" + signurl);
 try {

            JSONObject jsonObject = new JSONObject();
            jsonObject.put("first_name",Fname.getText().toString().trim());
            jsonObject.put("last_name",lname.getText().toString().trim());
            jsonObject.put("email",email.getText().toString().trim());
            jsonObject.put("phone",phone.getText().toString().trim());
            jsonObject.put("password",pass.getText().toString().trim());
            jsonObject.put("confirm_password",cpass.getText().toString().trim());
            jsonObject.put("deviceid","1");
            jsonObject.put("devicetoken", "1");
            jsonObject.put("devicetype", "1");
            jsonObject.put("country_code","+91");

            String obj=jsonObject.toString();

            Log.e("params", obj + "");

            queue = Volley.newRequestQueue(SignupActivity.this);


             JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, signurl, obj, new Response.Listener<JSONObject>() {

                @Override
                public void onResponse(JSONObject response) {


                    try {
                        Log.e("mmm", " " + response.toString());
                        JSONObject info=response.getJSONObject("detail");
                        int status=response.getInt("status");
                        System.out.println("stat"+status);
                        if(status==200){
                            String status_description=response.getString("status_description");
                            Toast.makeText(SignupActivity.this,status_description,Toast.LENGTH_SHORT).show();
                        }

                    } catch (JSONException e) {
                        e.printStackTrace();
                    }

                    Log.e("TAG", "Response " + response.toString());
                }

            }, new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError volleyError) {
                Log.e("err",""+volleyError.getMessage());
                }
            });
            System.out.println("req"+jsonObjectRequest);
            queue.add(jsonObjectRequest);

        } catch (JSONException e) {
              e.printStackTrace();

        }


}

0 个答案:

没有答案