In general, when I open the map, I get the user's locations, all good, but when I move the marker, the camera will move to the new location, and then back to the current location. When setting the marker to a new position, it is necessary to move the camera correctly (without returning to the location) and get the coordinates of the marker.

@Override public void onLocationChanged(Location location) { mLastLocation = location; if (mCurrLocationMarker != null) { mCurrLocationMarker.remove(); } //Place current location marker latLng = new LatLng(location.getLatitude(), location.getLongitude()); MarkerOptions markerOptions = new MarkerOptions(); markerOptions.position(latLng); markerOptions.draggable(true); markerOptions.title("Ваше местоположение"); markerOptions .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA)); mCurrLocationMarker = mMap.addMarker(markerOptions); //move map camera mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng)); mMap.animateCamera(CameraUpdateFactory.zoomTo(15)); //stop location updates //if (mGoogleApiClient != null) { LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this); // } mMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() { @Override public void onMapClick(LatLng point) { // TODO Auto-generated method stub // Creating a marker mMap.clear(); MarkerOptions marker = new MarkerOptions().position(new LatLng(point.latitude, point.longitude)) .title("Текущее местоположение"); // Animating to the touched position mMap.animateCamera(CameraUpdateFactory.newLatLng(latLng)); mMap.addMarker(marker); } }); } 

enter image description here

  • it seems that your bottommost one animateCamera () gets the wrong parameter. - tse
  • @tse ie need to transfer other data? - upward
  • The question is relevant! - upward

0