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 26 27 28 29 30 31
| public void onLocationChanged(Location location) {
/*
* Recuperation de la latitude et de la longitude
*/
lat = location.getLatitude();
lng = location.getLongitude();
/*
* Affichage de ces coordonnées
*/
Toast.makeText(getBaseContext(),"wadjo infos :\n"+
"Location change to : Latitude = " + lat + " Longitude = " + lng,
Toast.LENGTH_SHORT).show();
latitudeText.setText(String.valueOf(lat));
longitudeText.setText(String.valueOf(lng));
//afin de changer dynamiquement l'emplacement suite au changement de
//la lattitude et de la longitude
p=new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6));
//animer la mapControl afin de suivre les nouvelles coordonnées
//de longitude et latitude
mc.animateTo(p);
//centrer la carte sur ce geoPoint
mc.setCenter(p);
Log.i("Longitude = "+lng, "Latitude ="+p.getLatitudeE6());
} |
Partager