title: JsonObjectRequest and RequestQueue error
body: <p>SOLUTION: my problem was with the context, in case anyone else has the same problem.</p>
  
  <p>I am trying to make a request in my android app with JsonObjectRequest and RequestQueue with Volley lib but I am getting an error continuously.</p>
  
  <p>First, I tried to use just JsonObjectRequest (without RequestQueue) but I didn't get any data so I tried to use RequestQueue.</p>
  
  <ul>
  <li><p>Here is my code:</p>
  
  <pre><code>   JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, urlMarket, null, new Response.Listener&lt;JSONObject&gt;() {
          @Override
          public void onResponse(JSONObject response) {
              try {
                  JSONArray result = response.getJSONArray("result");
                  //we loop the response
                  for (int i = 0; i &lt; result.length(); i++) {
                      coin.setHigh(Double.parseDouble(result.getJSONObject(i).getString("High")));
                      coin.setLow(Double.parseDouble(result.getJSONObject(i).getString("Low")));
                      coin.setLast(Double.parseDouble(result.getJSONObject(i).getString("Last")));
                      coin.setVolInBtc(Double.parseDouble(result.getJSONObject(i).getString("BaseVolume")));
                      coin.setBid(Double.parseDouble(result.getJSONObject(i).getString("Bid")));
                      coin.setAsk(Double.parseDouble(result.getJSONObject(i).getString("Ask")));
                      coin.setPrevDay(result.getJSONObject(i).getString("PrevDay"));
  
  
                  }
              } catch (Exception e) {
                  e.printStackTrace();
              }
  
          }
      }, new Response.ErrorListener() {
          @Override
          public void onErrorResponse(VolleyError error) {
              error.printStackTrace();
          }
      });
  
      requestQueue.add(request);
  </code></pre></li>
  <li><p>That is the way I initialize requestQueue:</p>
  
  <pre><code>   requestQueue=Volley.newRequestQueue(context);
  </code></pre></li>
  <li><p>This is the error I am getting:</p>
  
  <pre><code>     java.lang.RuntimeException: Unable to start activity ComponentInfo{space.bewa.bewa_v10/space.bewa.bewa_v10.activities.DashboardActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.io.File android.content.Context.getCacheDir()' on a null object reference
                                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
                                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
                                                                   at android.app.ActivityThread.-wrap11(Unknown Source:0)
                                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
                                                                   at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                   at android.os.Looper.loop(Looper.java:164)
                                                                   at android.app.ActivityThread.main(ActivityThread.java:6494)
                                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                                   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
                                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
                                                                Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.io.File android.content.Context.getCacheDir()' on a null object reference
                                                                   at com.android.volley.toolbox.Volley.newRequestQueue(Volley.java:43)
                                                                   at com.android.volley.toolbox.Volley.newRequestQueue(Volley.java:78)
  </code></pre>
  
  <p>Any kind of help would be very appreciated</p></li>
  </ul>