On issue 3, I was able to work around it by extending MapView and overriding onTouchEvent(). I found that if I used MapView.setOnTouchListener() directly, MapView itself would call setOnTouchListener(), discarding my listener and replacing it with a zoom listener.
On Tue, Jun 9, 2009 at 2:02 PM, Philip Tucker <[email protected]> wrote: > (If there's a better place to post questions concerning the Google > Maps API please let me know, but it looks like this is the right > spot.) > > Requirement: > I have created a MapActivity containing a MapView. Drag and zoom work > fine, and I've successfully added an ItemizedOverlay that displays and > updates properly. Right now I can add OverlayItems to the map center > via a button, but I would like to add functionality allowing the user > to issue a long click to add an OverlayItem to the map at the selected > location. > > Issue 1 (minor): > It seems like there should be an easy way to determine the geo > location for a click event in MapView, but from what I've gathered it > requires writing my own pixel->latlong translation based on the view > span. Not a deal breaker, but seems like a common enough use case to > warrant addition to the API. > > Issue 2 (average): > My first attempt was to use setLongClickable(true) and > setOnLongClickListener, but that doesn't provide the click location. > The only param it receives it the View object, but I couldn't find any > way to determine the location of the click event. > > Issue 3 (major): > My second attempt was to use setOnTouchListener. This seems completely > broken to me. If I return true (ie, consume event) I continue getting > all touch events, but drag and zoom of the MapView do not work. That > seems like expected behavior. > If I return false (ie, do not consume the event) the map view > continues to work correctly. My listener receives ONLY the first touch > event. Stepping through in debug, it looks like > MapView.mOnTouchListener gets set to something like ZoomListener > (that's not the exact name, but it's close to that) and then to null > shortly after my listener is invoked. > Is there another preferred way of handling touch events in MapView? -- Philip Tucker [email protected] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

