0

J'ai un marqueur humanMarker sur la carte. Comment le faire bouger quand l'utilisateur bouge?Comment faire bouger le marqueur humain sur la carte?

private Marker humanMarker; 

humanMarker = map.addMarker(new MarkerOptions() 
       .position(new LatLng(mLocation.getLatitude(), mLocation.getLongitude())) 
       .icon(BitmapDescriptorFactory.fromResource(R.drawable.human))); 

Répondre

1

Essayez de remplacer la méthode onLocationChanged. humanMarker se déplace lorsque l'emplacement de l'utilisateur est modifié.

@Override 
public void onLocationChanged(Location location) { 
    // Update current location of the marker 
    humanMarker.setPosition(new LatLng(location.getLatitude(), location.getLongitude())); 
}