Created
February 20, 2015 15:35
-
-
Save pratamawijaya/588e6c35444df988777c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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