title: How to start onResponse method after getParams has been executed with StringRequest in Android Studio Volley?
body: <p>I am trying to start an JSONArrayRequests after the StringRequest has finished. The StringRequest is <code>POST</code> requet and the JSONArrayRequest is <code>GET</code> request. I want the JSONArray to start when the params of the String is uploaded so as I will be able to retrieve this data again. Below is my code:</p>
  <pre><code>RequestQueue requestQueue = Volley.newRequestQueue(getContext());
          StringRequest stringRequest = new StringRequest(Request.Method.POST, JSON_URL_UPLOAD_IMAGE, new Response.Listener&lt;String&gt;() {
              @Override
              public void onResponse(String response) {
                  try {
                      if (response.equals(&quot;1&quot;)) {
                          JsonArrayRequest arrayRequest = new JsonArrayRequest(Request.Method.GET, JSON_URL, null,
                                  new Response.Listener&lt;JSONArray&gt;() {
                                      @Override
                                      public void onResponse(JSONArray response) {
                                          for (int i=0;i&lt;response.length();i++) {
                                              try {
                                                  JSONObject object = response.getJSONObject(i);
                                                  String USER_ID = object.getString(&quot;user_id&quot;);
                                                  String POST_DATE = object.getString(&quot;post_date&quot;);
                                                  if (USER_ID.equalsIgnoreCase(CurrentUser)){
                                                      Toast.makeText(getContext(), &quot;First if.&quot;, Toast.LENGTH_SHORT).show();
                                                      if (POST_DATE.equalsIgnoreCase(dateTime)) {
                                                          Toast.makeText(getContext(), &quot;Second if.&quot;, Toast.LENGTH_SHORT).show();
                                                      }
                                                  }
                                              } catch (JSONException e) {
                                                  e.printStackTrace();
                                              }
                                          }
                                      }
                                  }, new Response.ErrorListener() {
                              @Override
                              public void onErrorResponse(VolleyError error) {
                                  Log.e(&quot;Volley Error&quot;, error.getMessage());
                              }
                          });
  
                          requestQueue.add(arrayRequest);
                          requestQueue.start();
  
                      }
  
                  }catch (Exception e) {
                      e.printStackTrace();
                      Log.d(&quot;ERROR&quot;, e.getMessage().toString());
                      Toast.makeText(getContext(), &quot;ERROR:&quot;+e.getMessage(), Toast.LENGTH_LONG).show();
                  }
  
              }
          }, new Response.ErrorListener() {
              @Override
              public void onErrorResponse(VolleyError error) {
  
              }
          }){
              @Nullable
              @Override
              protected Map&lt;String, String&gt; getParams() {
                  Map&lt;String, String&gt; params = new HashMap&lt;&gt;();
                  params.put(&quot;post_author&quot;, CurrentUser);
                  if (!details.getText().toString().equalsIgnoreCase(&quot;&quot;)){
                      params.put(&quot;post_content&quot;, details.getText().toString());
                      params.put(&quot;post_excerpt&quot;, details.getText().toString());
                  }else {
                      params.put(&quot;post_content&quot;, &quot;&quot;);
                      params.put(&quot;post_excerpt&quot;, &quot;&quot;);
                  }
                  params.put(&quot;post_date&quot;, dateTime);
                  params.put(&quot;post_date_gmt&quot;, dateTime);
                  params.put(&quot;post_title&quot;, CurrentUser+&quot;-&quot;+CurrentUser+&quot;-&quot;+timeStampStr);
                  params.put(&quot;post_status&quot;, &quot;publish&quot;);
                  params.put(&quot;comment_status&quot;, &quot;closed&quot;);
                  params.put(&quot;ping_status&quot;, &quot;closed&quot;);
                  params.put(&quot;post_name&quot;, CurrentUser+&quot;-&quot;+CurrentUser+&quot;-&quot;+timeStampStr);
                  params.put(&quot;post_modified&quot;, dateTime);
                  params.put(&quot;post_modified_gmt&quot;, dateTime);
                  params.put(&quot;guid&quot;, &quot;https://www.selfcial.com/peepso-post/&quot;+CurrentUser+&quot;-&quot;+CurrentUser+&quot;-&quot;+timeStampStr+&quot;/&quot;);
                  params.put(&quot;post_type&quot;, &quot;peepso-post&quot;);
                  return params;
              }
          };
  
  
          requestQueue.add(stringRequest);
          requestQueue.start();
  </code></pre>
  <p>What I tried to do is to add a RequestQueue in order to make the requests wait until the other one is finished but it didn't work. The problem I have is that when the inside request starts it doesn't find the &quot;if&quot; statement(namely this:<code>(USER_ID.equals(CurrentUser) &amp;&amp; POST_DATE.equals(dateTime)</code>). So, what I can understand is that the second starts before the first has finished with the params. What can I do? Any answer will be appreciated!</p>