I want to post boolean,double data using volley library.I am not getting how to use it.Is there any other process.Thanks in advance.
Here is my method....
Here is the complete request of a volley call. You can change the method call. You can pass any type of parameters as a JSON object You can set request header
JSONObject jsonObject = new JSONObject();
jsonObject.put("stringValue", "abc");
jsonObject.put("doubleValue", 13.066);
jsonObject.put("integerValue", 120);
jsonObject.put("booleanValue", true);
JsonObjectRequest request = new JsonObjectRequest(Request.Method.POST, getString(R.string.api_url), jsonObject,
new Response.Listener() {
@Override
public void onResponse(JSONObject response) {
getJsonResult(response);
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
}
) {
@Override //Send Header
public Map getHeaders() throws AuthFailureError {
Map params = new HashMap<>();
params.put("api_call_header", "header_value");
return params;
}
};
// Adding request to request queue
AppController.getInstance().addToRequestQueue(request);`enter code here`