title: LatLng Arraylist is not returning in onReponse() Volley
body: <p>I am getting a list of latitude and longitude using volley from my server. Here is the function.</p>
  
  <pre><code>private List&lt;LatLng&gt; getLocations() {
      final List&lt;LatLng&gt; pos = new ArrayList&lt;&gt;();
      StringRequest rqst = new StringRequest(Request.Method.POST, "http://www.findandgo.in/server/getAllUsersLocation.php",
              new Response.Listener&lt;String&gt;() {
          @Override
          public void onResponse(String response) {
              try {
                  JSONArray array = new JSONArray(response);
                  for (int i=0; i&lt;array.length(); i++) {
                      JSONObject object = array.getJSONObject(i);
                      Double lat = Double.parseDouble(object.getString("user_latitude"));
                      Double longi = Double.parseDouble(object.getString("user_longitude"));
                      LatLng latLng = new LatLng(lat,longi);
                      pos.add(latLng);
  //here the list is returning size
                      }
                  } catch (JSONException e) {
                      e.printStackTrace();
                  }
              }
          }, new Response.ErrorListener() {
              @Override
              public void onErrorResponse(VolleyError error) {
                  error.printStackTrace();
                  Toast.makeText(HomeActivity.this,error.toString(),Toast.LENGTH_SHORT).show();
              }
          });
          RequestQueue rq = Volley.newRequestQueue(getApplicationContext());
          rq.add(rqst);
          //here the list is showing size 0
          return pos;
      }
  </code></pre>
  
  <p>The above function is returning null list but when I use log value in onResponse to see if the value is present, it shows.</p>