I ran into a problem with the implementation of the zoom software on the android. In a nutshell, I made an overlay with buttons on top of the map and when pressed, the zoom should change, but nothing happens. Here is the code snippet:

mapButtonZoomPlus.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mZoom += 1; Log.d(TAG, "mapButtonZoomPlus click"); CameraPosition lCameraPosition = new CameraPosition(map.getMapWindow().getMap().getCameraPosition().getTarget(), mZoom, 0f, 0f); com.yandex.mapkit.Animation lAnimation = new com.yandex.mapkit.Animation(com.yandex.mapkit.Animation.Type.SMOOTH, 0.3f); map.getMapWindow().getMap().move(lCameraPosition, lAnimation, null); } }); 

getMapWindow () cleared, but the result is zero. At the same time, the zoom is fine tuned with your fingers. Tell me what could be the reason?

    2 answers 2

    Probably the wrong mZoom value, and it’s better to write this:

     CameraPosition lCameraPosition = new CameraPosition(map.getCameraPosition().getTarget(), map.getCameraPosition().getZoom() + 1, map.getCameraPosition().getAzimuth(), map.getCameraPosition().getTilt()); 

      Understood the reason. It turns out in my case that for some reason it was necessary to call the OnStart () method after the map view render with the view itself: mapVew.onStart();