1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| jsonObject = json.init(Config.COMMUNES_URL);
Iterator iter = jsonObject.keys();
while(iter.hasNext()){
String key = (String)iter.next();
String value = jsonObject.getString(key); // provoque bug, out of memory
JSONObject jsonCommunes = new JSONObject(value);
Iterator iterCommunes = jsonCommunes.keys();
Commune commune = new Commune();
while(iterCommunes.hasNext()){
String keyCommune = (String)iterCommunes.next();
String valueCommune = jsonCommunes.getString(keyCommune);
if(keyCommune.equalsIgnoreCase("com_id"))
commune.setId(valueCommune);
if(keyCommune.equalsIgnoreCase("com_libelle"))
commune.setLibelle(valueCommune);
if(keyCommune.equalsIgnoreCase("com_latitude"))
commune.setLatitude(valueCommune);
if(keyCommune.equalsIgnoreCase("com_longitude"))
commune.setLongitude(valueCommune);
}
communesList.add(commune);
} |
Partager