Posting form-data Parameters in the body using Volley Posting form-data Parameters in the body using Volley json json

Posting form-data Parameters in the body using Volley


Just try with below code this will use to send simple post data using volley, just replace URL and parameter data.

StringRequest stringRequest = new StringRequest(Request.Method.POST, REGISTER_URL,                    new Response.Listener<String>() {                        @Override                        public void onResponse(String response) {                            Toast.makeText(MainActivity.this,response,Toast.LENGTH_LONG).show();                        }                    },                    new Response.ErrorListener() {                        @Override                        public void onErrorResponse(VolleyError error) {                            Toast.makeText(MainActivity.this,error.toString(),Toast.LENGTH_LONG).show();                        }                    }){                @Override                protected Map<String,String> getParams(){                    Map<String,String> params = new HashMap<String, String>();                    params.put(KEY_USERNAME,username);                    params.put(KEY_PASSWORD,password);                    params.put(KEY_EMAIL, email);                    return params;                }            };            getRequestOtpPage().addToRequestQueue(stringRequest);