I’m a novice Android monkey and I’ve hit a snag trying to implement a feature on my app. What I want to do is have my users be able to long click an overlay item (it’s a bus stop) and add that marker (stop number and address) to their favorites tab. The problem is… how do I listen for and handle a long click(tap) on an overlay item??
Currently I’m @overriding the onTap function in my Overlay class to handle regular taps, but I don’t see an onLongTap function to override in the documentation… Can anyone set me along the right path? Am I missing something obvious here? Thanks for reading this
P.S. This is my first SO question 🙂
You probably want to override
onTouchEvent(MotionEvent, MapView)for more complex user interactions. For a ‘long’ tap, you should start some sort of timer that will indicate how long the user has been pressing on a specific Overlay item. Once a certain threshold is reached – I believe the default delay for a ‘long’ press is roughly 1500 ms – you then execute the relevant code.Alternatively, you could take a look at including the mapview-overlay-manager project, which, from the reads of it, should offer exactly what your looking for (and then some):