private void getStopLocation(String stopId) {
        final RequestQueue queue = Volley.newRequestQueue(this);
        Uri stopUrlUri = Uri.parse(getStopUrl)
                .buildUpon()
                .appendQueryParameter(key_param, getResources().getString(R.string.api_key))
                .appendQueryParameter(stop_param, stopId)
                .build();
        String stopUrl = stopUrlUri.toString();
        JsonObjectRequest locationRequest = new JsonObjectRequest(Request.Method.GET, stopUrl, null, new Response.Listener<JSONObject>() {
            @Override
            public void onResponse(JSONObject response) {
                try {
                    stopLatlon = new double[2];
                    JSONArray stopsArray = response.getJSONArray("stops");
                    JSONObject stop = stopsArray.getJSONObject(0);
                    JSONArray pointsArray = stop.getJSONArray("stop_points");
                    JSONObject point = pointsArray.getJSONObject(0); //TODO: determine which corner I should use
                    stopLatlon[0] = point.getDouble("stop_lat");
                    stopLatlon[1] = point.getDouble("stop_lon");
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
            }
        });
        queue.add(locationRequest);
    }
private void getStopLocation(String stopId) {
        final RequestQueue queue = Volley.newRequestQueue(this);
        Uri stopUrlUri = Uri.parse(getStopUrl)
                .buildUpon()
                .appendQueryParameter(key_param, getResources().getString(R.string.api_key))
                .appendQueryParameter(stop_param, stopId)
                .build();
        String stopUrl = stopUrlUri.toString();
        JsonObjectRequest locationRequest = new JsonObjectRequest(Request.Method.GET, stopUrl, null, new Response.Listener<JSONObject>() {
            @Override
            public void onResponse(JSONObject response) {
                try {
                    stopLatlon = new double[2];
                    JSONArray stopsArray = response.getJSONArray("stops");
                    JSONObject stop = stopsArray.getJSONObject(0);
                    JSONArray pointsArray = stop.getJSONArray("stop_points");
                    JSONObject point = pointsArray.getJSONObject(0);
                    stopLatlon[0] = point.getDouble("stop_lat");
                    stopLatlon[1] = point.getDouble("stop_lon");
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
            }
        });
        queue.add(locationRequest);
    }
private void getstoplocation(string stopid) { final requestqueue queue = volley.newrequestqueue(this); uri stopurluri = uri.parse(getstopurl) .buildupon() .appendqueryparameter(key_param, getresources().getstring(r.string.api_key)) .appendqueryparameter(stop_param, stopid) .build(); string stopurl = stopurluri.tostring(); jsonobjectrequest locationrequest = new jsonobjectrequest(request.method.get, stopurl, null, new response.listener<jsonobject>() { @override public void onresponse(jsonobject response) { try { stoplatlon = new double[2]; jsonarray stopsarray = response.getjsonarray("stops"); jsonobject stop = stopsarray.getjsonobject(0); jsonarray pointsarray = stop.getjsonarray("stop_points"); jsonobject point = pointsarray.getjsonobject(0); stoplatlon[0] = point.getdouble("stop_lat"); stoplatlon[1] = point.getdouble("stop_lon"); } catch (jsonexception e) { e.printstacktrace(); } } }, new response.errorlistener() { @override public void onerrorresponse(volleyerror error) { } }); queue.add(locationrequest); }