try {
regions = json.getJSONArray(TAG_REGIONS);
for (int i = 0; i < regions.length(); i++) {
JSONObject c = regions.getJSONObject(i);
String regionName = c.getString(TAG_REGION_NAME);
areas = json.getJSONArray(TAG_AREA);
for (int j = 0; j < areas.length(); j++) {
JSONObject d = areas.getJSONObject(j);
String areaName = d.getString(TAG_AREA_NAME);
shops = json.getJSONArray(TAG_SHOP);
for (int k = 0; k < shops.length(); k++) {
JSONObject e = shops.getJSONObject(k);
String id = e.getString(TAG_ID);
String shopName = e.getString(TAG_SHOP_NAME);
String shopNameForGoogle = e.getString(TAG_SHOP_NAME_GOOGLE);
String img = e.getString(TAG_IMAGE);
String address = e.getString(TAG_ADDRESS);
String tel = e.getString(TAG_TEL);
String hrs = e.getString(TAG_HRS);
String lat = e.getString(TAG_LAT);
String lng = e.getString(TAG_LNG);
}
}
}
} catch (JSONException e) {
e.printStackTrace();
}
以上是从json文件中收集的数据。结构是
regions
->areas
->shops
我应该使用 arrayList 来存储它吗?存储商店列表后如何参考?谢谢。