0

I have an Android app with a MapView, and zoom controls have been implemented. But I want to detect when the zoom level has changed, so I can do certain things when that happens. Is there any listener to do that? Any example?

Roman Rdgz
  • 12,836
  • 41
  • 131
  • 207

1 Answers1

7

With a little bit of research, I found this site:

http://pa.rezendi.com/2010/03/responding-to-zooms-and-pans-in.html

Specifically, this code:

int oldZoomLevel=-1;

public void dispatchDraw(Canvas canvas) {
 super.dispatchDraw(canvas);
  if (getZoomLevel() != oldZoomLevel) {
   //do your thing
   oldZoomLevel = getZoomLevel();
  }
}

Would seem to do more or less what you want.

Edit:

In other words, you can solve this by subclassing the mapview, and override the dispatchDraw.

Edwardly
  • 183
  • 5