5

I want to monitor when someone moves to another place on the map in a MapActivity but I have no idea how to do that. Maybe some sort of OnMapChange() listener?

Mats Hofman
  • 7,060
  • 6
  • 33
  • 48
  • you might want to look into the `onDraw` method somewhere.. it will get called when the view needs to draw itself(like when the map is changing, moving, etc). just a thought – james Jan 06 '11 at 21:39

1 Answers1

5

You can extend the MapView class to add the necessary map change event. http://bricolsoftconsulting.com/extending-mapview-to-add-a-change-event/

The post above shows you how to detect zooming and panning via virtually every way you can interact with the map: swipe (for pan), zoom control +/- (for zooming) and pinch (for combined pan and zoom).

Theo
  • 5,963
  • 3
  • 38
  • 56
  • Great project! Thank you for the link. I cleaned the repository somewhat in my [fork](https://github.com/johnjohndoe/MapChange/tree/cleaning). – JJD Apr 09 '12 at 01:28
  • I also have a small MapView class with three events, onClick, onPan and onZoom [on my blog here](http://mpcabd.igeex.biz/android-map-view-with-pan-zoom-events/). – mpcabd Sep 28 '12 at 12:30