Question

Given ...

  • An Activity that extends from MapActivity
  • Uses ItemizedOverlay to show some balloons on the map
  • ZoomControls are enabled

The ItemizeOverlay implements onTap(...) which works perfectly ok when tapping one of the overlay items.

The question is: How to identify a tap on another part of the map (with the intention of getting the location and center'ing on that point)

Was it helpful?

Solution

You should be able to create an 'invisible' overlay (in the sense that you don't draw anything in onDraw) that sits at the front of the MapView's overlay list and in onTap, sets the map center with MapController.setCenter.

To quote the MapView.getOverlays documentation regarding overlay ordering:

Any Overlays in this list will be drawn (in increasing order) and will receive events (in decreasing order, until one returns true). If you modify the list, you will probably want to call View.postInvalidate() so that the change will be made visible to the user.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top