Bonjour,
En fait j'ai crée un projet android dans lequel j'aurais besoin que l'utilisateur, suite a un listener (toucher l'ecran) peut pouvoir se situer dans la map.
J'ai procédé ainsi dans mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
32
33
34
35
36
37
38
   mapView = (MapView) this.findViewById(R.id.mapView);
   mapView.setBuiltInZoomControls(true);
   lm = (LocationManager) this.getSystemService(LOCATION_SERVICE);
   lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 10000, 0, this);
   lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 10000, 0, this);
 
   mc = mapView.getController();
   //localisation du user
   myLocation = new MyLocationOverlay(getApplicationContext(), mapView);
 
   //location manager
   locManager = (LocationManager)getSystemService(this.LOCATION_SERVICE); 
   locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,1000L,500.0f, locationListener);
   Location location = locManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
   if(location != null)                                
   {
       lat = location.getLatitude();
       lng = location.getLongitude();
 
  	 Toast.makeText(getBaseContext(),"wadjo infos :\n"+
  			 "Location change to : Latitude = " + lat + " Longitude = " + lng,
  			 Toast.LENGTH_SHORT).show();	
 
  			 //afin de changer dynamiquement l'emplacement suite au changement de
  			 //la lattitude et de la longitude
 
  			 GeoPoint p = new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6));
  			 mc.animateTo(p);
  			 mc.setCenter(p);
   }  
 
	myLocation.runOnFirstFix(new Runnable() {
	    public void run() {
		mc.animateTo(myLocation.getMyLocation());
		mc.setZoom(17);
	    }
	});
   mapView.getOverlays().add(myLocation);
Mais j'aimerais bien que ce soit dynamique le tag sur la map (en fait ca marche mais simplement en envoyant les valeur avec l'émulateur).
J'attends votre aide, merci