title: Volley JsonObjectRequest send headers in GET Request
body: <p>I am trying to send some authentication headers from <code>GET</code> request and I tried using <code>Volley JsonObjectRequest</code> call :</p>
  
  <pre><code>Map&lt;String,String&gt; params=new HashMap&lt;String,String&gt;();
          params.put("token","fghjbvjhnjjk");
          activity.showDialog();
          JsonObjectRequest req = new JsonObjectRequest(Request.Method.GET,url,
                  new JSONObject(params), new Response.Listener&lt;JSONObject&gt;() {
  
              @Override
              public void onResponse(JSONObject response) {
                  Log.d(tag, response.toString());
                  activity.hideDialog();
                  try {
                      activity.onRequestServed(response, code);
                  } catch (JSONException e) {
                      e.printStackTrace();
                  }
              }
          }, new Response.ErrorListener() {
              @Override
              public void onErrorResponse(VolleyError error) {
                  VolleyLog.d(tag, "Error: " + error.getMessage());
                  Log.e(tag, "Site Info Error: " + error.getMessage());
                  Toast.makeText(activity.getApplicationContext(),
                          error.getMessage(), Toast.LENGTH_SHORT).show();
                  activity.hideDialog();
                  try {
                      activity.onRequestServed(null,code);
                  } catch (JSONException e) {
                      e.printStackTrace();
                  }
              }
          });
          req.setShouldCache(true);
  </code></pre>
  
  <p>But its showing: <br></p>
  
  <pre><code>Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.hashCode()' on a null object reference
          at com.android.volley.Request.&lt;init&gt;(Request.java:136)
          at com.android.volley.toolbox.JsonRequest.&lt;init&gt;(JsonRequest.java:58)
          at com.android.volley.toolbox.JsonObjectRequest.&lt;init&gt;(JsonObjectRequest.java:47)
  </code></pre>
  
  <p>I read somewhere that you can pass headers by making a <code>hashmap</code> and thus create a new <code>JsonObject</code> with that parameter. Maybe that will work on a <code>POST</code> request. Please help..</p>