如何让人体标记在地图上移动?

How to make the human marker move on the map?

我在地图上有一个标记 humanMarker。如何让它在用户移动时移动?

private Marker humanMarker;

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

尝试覆盖 onLocationChanged 方法。 humanMarker 会在用户位置改变时移动。

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