2017-05-20 12 views
0

私は地図上にマーカーhumanMarkerを持っています。ユーザーが動いているときに動かす方法は?人間のマーカーを地図上で動かすには?

private Marker humanMarker; 

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

答えて

1

onLocationChangedメソッドをオーバーライドしてください。 humanMarkerは、ユーザーの場所が変更されたときに移動します。

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