Q:

Volley priority doesn't work properly

I have to make two calls with volley. My problem is that I need to be done the first call and then the second. The calls are on a for loop. So I put on the first call Priority.IMMEDIATE and on the second Priority.LOW. But sometimes the second call is done before the first and I doesn't have the data that I need from the first call. What am I missing?
    for (int i = 0; i < SiteData.getSites().size(); i++) {
          firstCall();
          secondCall();
     }

the firstCall method
private void firstCall(){
    JsonObjectRequest siteDataRequest = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {
         @Override
         public void onResponse(JSONObject response) {
            // do something with json
         }
     }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
          VolleyLog.d(membership_id_tag, error.getMessage());
        }
    })

    {
       @Override
       public Priority getPriority() {
          return Priority.IMMEDIATE;
       }
    };
    AppController.getInstance().addToRequestQueue(siteDataRequest, membership_id_tag);
}

the secondCall method
private void secondCall(){
    JsonArrayRequest pagesRequest = new JsonArrayRequest(Request.Method.GET, url, null, new Response.Listener<JSONArray>() {
       @Override
       public void onResponse(JSONArray response) {
          // do something with json
        }
     }, new Response.ErrorListener() {
         @Override
         public void onErrorResponse(VolleyError error) {
            VolleyLog.d(membership_page_tag, error.getMessage());
         }
      })

      {
          @Override
          public Priority getPriority() {
             return Priority.LOW;
          }
      };
      AppController.getInstance().addToRequestQueue(pagesRequest, membership_page_tag);
}

Do I have to make the first call on a loop and the second on other?

A:

Try doing the serving call in the response if the first, also the priority  might be happening because there are 2 different request queue that are being used.

