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....
JSONObject object = new JSONObject();
try {
object.put("compression", false);
object.put("instructions", true);
} catch (JSONException e) {
e.printStackTrace();
}
JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, API_URL, object, new Response.Listener() {
@Override
public void onResponse(JSONObject response) {
parseDirectionsData(response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
error.printStackTrace();
}
}){
@Override
protected Map getParams() throws AuthFailureError {
HashMap params = new HashMap<>();
params.put("loc", "-33.9717974,18.6029783");
return params;
}
};
Any of the parameters that are not Strings you can wrap them into the Json Object.