title: How to get current GoogleMap zoom level?
body: <p>On GoogleMap android API v2, how do I get the current map zoom level? On API v1, there used to be <code>float MapView.getZoomLevel()</code>, but there appears to be nothing similar on the API version I am using, and that Google recommends.</p>
  
  <p>I've thought of using a class variable to save the zoom level manually via a zoom button click listener, but this doesn't solve the problem for pinch-type zooming.</p>
  
  <p>Why do I need the current zoom level? I am restricting the map range to a certain rectangle and want any moves that would otherwise leave this rectangle, bounce back. This animation requires me to use a zoom level, for without it, the default maximum zoom level is used. What I really want is to maintain the zoom level used before the move attempt.</p>
  
  
  
  <pre class="lang-java prettyprint-override"><code>protected void recenterMap() {
      map.getMinZoomLevel();
      if(MAP_BOUNDS.contains(map.getCameraPosition().target) == false) {
          CameraPosition cameraPosition = new CameraPosition.Builder()
          .target(MAP_CENTER)      
          .zoom(current_zoom)
          .build();     
  
          map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
      } else {
          MAP_CENTER = map.getCameraPosition().target;
      }
  }
  </code></pre>
  
  <p>Notice that the variable <code>current_zoom</code> is what I need to define.</p>