1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| try{
JSONArray jArray = new JSONArray(result);
for(int i=0;i<jArray.length();i++)
{
JSONObject json_data = jArray.getJSONObject(i);
Log.i("log_tag","la latitude: "+json_data.getDouble("altitude")+",la longitude: "+json_data.getDouble("longitude"));
lat1 = json_data.getDouble("altitude");
long1=json_data.getDouble("longitude");
itemizedoverlay.addOverlayitem(new OverlayItem(new GeoPoint((int)(lat1 * 1e6), (int)(long1 * 1e6)), "", ""));
}
List<Overlay> mapOverlays = mapView.getOverlays();
mapOverlays.add(itemizedoverlay);
}catch(JSONException e){
Log.e("log_tag", "erreur parsing data "+e.toString());
} |
Partager