1

In mapbox v9 I could animate the camera using the animatecamera method.

In mapbox v10 it says to use flyTo or easeTo. However none of these methods exist in the mapboxMap object?

mapView = findViewById(R.id.mapView)
mapboxMap = mapView.getMapboxMap()
mapboxMap.flyTo();  //Method not found??

Sorry but I am not familiar with Kotlin, so this question is for a java based solution.

Mapbox help section:

https://docs.mapbox.com/android/maps/guides/migrate-to-v10/
Reafidy
  • 8,240
  • 5
  • 51
  • 83
  • 1
    It should be `flyTo`. You may check the API docs here: https://docs.mapbox.com/android/maps/guides/camera-and-animation/animations/ – Manish Nov 08 '21 at 01:51
  • @Manish thanks but that's just a typo, and the method still does not exist. I'm not using Kotlin. – Reafidy Nov 08 '21 at 02:02

1 Answers1

1

Received the answer elsewhere. Correct way to animate the camera in java is as below:

final Cancelable cancelable = CameraAnimationsUtils.easeTo(mapView.getMapboxMap(), new CameraOptions.Builder().zoom(5.0).build(), new MapAnimationOptions.Builder().duration(4000).build());

// or to get actual object of animation plugin and call functions directly with it

final CameraAnimationsPlugin camera = CameraAnimationsUtils.getCamera(mapView);
final Cancelable cancelable = camera.easeTo(
        new CameraOptions.Builder().zoom(5.0).build(),
        new MapAnimationOptions.Builder().duration(4000).build()
);
Reafidy
  • 8,240
  • 5
  • 51
  • 83
  • where did you get that answer? I'm also not familiar with kotlin. I'm stuck on how to disable gestures on the map. Do you have any idea how to do that on java? – karatuno Nov 22 '21 at 10:55
  • @karatuno yes I can help you with that, can you start a question and I will post the answer for you. – Reafidy Nov 23 '21 at 07:29
  • https://stackoverflow.com/questions/70053011/how-do-i-disable-gestures-add-markers-and-show-location-in-mapbox-v10-0-android Here's the question – karatuno Nov 23 '21 at 09:41