It's easy my friend. first of all read the response from your url. ... it will return you the json then use the following code to run
public static String getAddress(JSONObject result) {
if (result.has("results")) {
try {
JSONArray array = result.getJSONArray("results");
if (array.length() > 0) {
JSONObject place = array.getJSONObject(0);
JSONArray components = place.getJSONArray("address_components");
for (int i = 0; i < components.length(); i++) {
JSONObject component = components.getJSONObject(i);
JSONArray types = component.getJSONArray("types");
for (int j = 0; j < types.length(); j++) {
if (types.getString(j).equals("route")) {
return component.getString("long_name");
}
}
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
return null;
}
In my current code, i am parsing it for the specific routes .... just skip the condition and save the result in your Data structure object