Android studio google maps activity error creating map markers on Create but works with button? : Im working on an android application in android studio, and the rest of the application is developed including the map activity. the map markers get their location from a web API that returns the lat and long in a JSON format. the code works perfectly doing everything i want when it is inside the onClickListener and the corresponding button is pressed, but i want the markers to load instantly in onCreate so that the user doesn't have to press a button to load the markers. however when i take the exact same code and put it in oncreate it doesn't work at all, the errorListener is called, but when i try print the error message it is blank??? 

here is the code (thanks in advance) 

`loadMachines.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                StringRequest st = new StringRequest(Request.Method.POST, URL, new Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {
                        try {

                            JSONObject jsonarray = new JSONObject(response);
                            JSONArray machinesArray  = jsonarray.getJSONArray("machines");
                            for (int i = 0; i < machinesArray.length();i++){
                                JSONObject machineProperties = machinesArray.getJSONObject(i);

                                String addr1 = machineProperties.getString("address_1");
                                String addr2 = machineProperties.getString("address_2");
                                String lat = machineProperties.getString("lat");
                                String lng = machineProperties.getString("lng");

                                MarkerOptions options = new MarkerOptions().title(addr1 + " " + addr2).position(new LatLng(Double.parseDouble(lat),Double.parseDouble(lng)));
                                mGoogleMap.addMarker(options);

                            }


                            Toast.makeText(MapActivity.this, "Success, we have updated the locations, zoom out to view!", Toast.LENGTH_SHORT).show();

                        } catch (JSONException e) {
                            e.printStackTrace();
                           
                        }
                    }
                }, new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {
                        if (error.networkResponse.statusCode == 500) {
                            Toast.makeText(MapActivity.this , "Internal Server Error", Toast.LENGTH_SHORT).show();
                        }else{
                            Toast.makeText(MapActivity.this, error.getMessage(), Toast.LENGTH_SHORT).show();
                        }

                    }
                }) {
                    protected Map<String, String> getParams() throws AuthFailureError {
                        Map<String, String> params = new HashMap<String, String>();
                        params.put("key", "****");
                        params.put("token", tokenString);
                        params.put("user_lat", String.valueOf(getLatitude()));
                        params.put("user_lng", String.valueOf(getLatitude()));


                        return params;
                    }
                };
                MySingleton.getInstance(MapActivity.this).addToRequestQueue(st);
            }
    });`

 