I am trying to send some data to the server using the Volley library.
private void registerUser(final String email, final String username,
requestQueue= Volley.newRequestQueue(MainActivity.this);
StringRequest request=new StringRequest(Request.Method.PUT, url, new Response.Listener() {
@Override
public void onResponse(String response) {
Toast.makeText(MainActivity.this, ""+response, Toast.LENGTH_SHORT).show();
Log.d("response",response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
}){
@Override
protected Map getParams() throws AuthFailureError {
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("name", name.getText().toString().trim());
jsonObject.put("email", email.getText().toString().trim());
jsonObject.put("phone", phone.getText().toString().trim());
} catch (JSONException e) {
e.printStackTrace();
}
Map params = new HashMap();
params.put("message", jsonObject.toString());
return params;
}
};
requestQueue.add(request);
[["deep","dee@gmail.com","8888999999"]]