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?
Asked
Active
Viewed 954 times
0
-
have a look [here](http://stackoverflow.com/q/2013443/593709) – Adil Soomro Oct 06 '11 at 11:52
1 Answers
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