/**
     * inserts values into stopLatlon with stop_id
     * @param stopId
     */
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); //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); //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); //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);
}