这很容易我的朋友。首先阅读你的网址的回应。 ......它会回报你的JSON然后使用下面的代码运行
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;
}
在我当前的代码,我解析它的具体途径....只是跳过条件和结果保存在您的数据结构对象
但我如何给拉特lng列表获取地址数组可以请告诉我或给我的线。 – 2014-10-02 05:28:31