views:

619

answers:

1

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)

A: 

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.

Roman Nurik
@Gray-M: Did this work? If not, please comment and/or edit the original question so I or others can follow up.
Roman Nurik
@Roman - Sorry, was put on another project.I've done a quick private test and this does seem to solve the problem although I've not been able to fully test it.
Gray-M