title: Send form-urlencoded parameters in post request android volley
body: <p>I want to make a POST JSONObjectRequest with form urlencoded parameters. How can I do this? I've tried the following code, but to no avail.</p>
  
  <pre><code>final String api = "http://api.url";
  final JSONObject jobj = new JSONObject();
  jobj.put("Username", "usr");
  jobj.put("Password", "passwd");
  jobj.put("grant_type", "password");
  
  final JsonObjectRequest jor = new JsonObjectRequest(
  
      Request.Method.POST, 
      api, jobj, 
      new Response.Listener&lt;JSONObject&gt;() {
          @Override
          public void onResponse(JSONObject response) {
              Toast.makeText(getApplicationContext(), "Login Successful!", Toast.LENGTH_LONG).show();
              //do other things with the received JSONObject
          }
      }, 
      new Response.ErrorListener() {
          @Override
          public void onErrorResponse(VolleyError error) {
              Toast.makeText(getApplicationContext(), "Error!", Toast.LENGTH_LONG).show();
          }
      }) {
  
      @Override
      public Map&lt;String, String&gt; getHeaders() throws AuthFailureError {
          Map&lt;String, String&gt; pars = new HashMap&lt;String, String&gt;();
          pars.put("Content-Type", "application/x-www-form-urlencoded");
          return pars;
      }
  };
  
  //add to the request queue
  requestqueue.AddToRequestQueue(jor);
  </code></pre>
  
  <p>I'm getting a 400 bad request with the api call! How can I fix it?</p>