Skip to content

Instantly share code, notes, and snippets.

@pratamawijaya
Created February 20, 2015 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pratamawijaya/588e6c35444df988777c to your computer and use it in GitHub Desktop.
Save pratamawijaya/588e6c35444df988777c to your computer and use it in GitHub Desktop.
private void getDirections(String URL) {
JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET,
URL, null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject jsonObject) {
progressDialog.dismiss();
response = new Gson().fromJson(jsonObject.toString(), com.pratamawijaya.panggilpeta.json.Response.class);
Log.d("debug", "" + response.getRouteList().get(0).getLegsList().get(0).getDistance());
// Fetch Directions From Json
fetchDirection(response.getRouteList().get(0).getLegsList().get(0).getStepsList());
saveToDb(response.getRouteList().get(0).getLegsList().get(0));
// TODO: Save to DB
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
progressDialog.dismiss();
Log.d("error", "" + volleyError.toString());
}
});
progressDialog.show();
BaseApplication.getInstance().addToRequestQueue(request, "tag");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment