tags:

views:

555

answers:

2

Hi,

I've implemented a Class that extends Overlay and also override the onTap / onTouchEvent (tried both).

Right now it seems like that event is triggered when you tap on the map regardless of position.
How can I make sure that the event is triggered only when you tap over the overlay you have added?

Thanks,
Tee

+1  A: 

The overlay covers the entire map.

If you only want tap events when they tap on one of your items in an ItemizedOverlay, use onTap().

CommonsWare
Hi @CommonsWare, can you elaborate what you mean? I tried onTap as well and the onTap still gets triggered when I tap anywhere on the map. Thanks, Tee
teepusink
I have done a lot of development with `MapView` and `ItemizedOverlay`, and `onTap()` does *not* get called when you tap anywhere, only when you tap on an overlay item. Take a look at this project for an example: http://github.com/commonsguy/cw-android/tree/master/Maps/NooYawk/
CommonsWare
Thanks! For me - all I needed this kind of simple example!
sniurkst
how do you detect that the screen was touched but none of them were tapped?
schwiz
oh i see how you did it in your example, you would think there would be an idiot proof way.
schwiz
A: 

Yes. I also have the same problem. You of course can use ItemizedOverlay when you only want tap event. But If I want to trigger OnTouchEvent,How? Thanks advance.

landry