Handling Touch Events on an OpenStreetMap Overlay
In Chapter: Location and Map Applications
Author: Rachee Singh ('racheesingh')
You need to perform actions when the overlay on an OpenStreetMap is tapped
Overriding the methods of OnItemGestureListener method for single tap events and long press events.
To address touch events on the map overlay, we modify the way we instantiate an overlay item (To see more details about using overlays in OSM, check out: Creating overlays in OpenStreetMaps4547 ). While instantiating the OverlayItem, we make use of an anonymous object of OnItemGestureListener class as an argument and provide our own implementation of onItemSingleTapUp and onItemLongPress methods. In these methods, we simply display a toast depicting which action took place: single tap or long press and also the title and description of the overlay touched.
Here is how the code looks:
The source code for this project can be downloaded from