Re: [android-developers] getting clicks on a map view
Using Mark Murphy's online books, he describes how to do this. I don't know if it is the only way, but basically you extend ItemizedOverlayOverlayItem, in the constructor you do the items.add(OverlyaItem) method call. This will add overlayitem's to the map. These items are clickable and you can implement the click handler in the OverlayItem extending class that you provide/add. I recommend his books. He responds here a lot and has his own forum and weekly chats as well. Well worth $40. On Thu, Jan 14, 2010 at 3:01 PM, Jason Proctor jason.android.li...@gmail.com wrote: i'm looking to get called when the user taps on any part of a map view and i'm having no luck so far. mapView.setOnClickListener() overlay.onTap() overlay.onTouchEvent() none of these produces as much as a peep when the map view is clicked. i did some googling and found this thread -- http://groups.google.com/group/android-developers/browse_thread/thread/c48e2b9368c75e5a which suggests that overriding mapView.onTouchEvent() works, though calling setOnTouchListener() doesn't. however, onTouchEvent() didn't work for me. tried with the map view set to clickable or unclickable, no difference. can i get clicks on map views? thanks -- jason.vp.engineering.particle -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] getting clicks on a map view
Kevin Duffey wrote: Using Mark Murphy's online books, he describes how to do this. I don't know if it is the only way, but basically you extend ItemizedOverlayOverlayItem, in the constructor you do the items.add(OverlyaItem) method call. This will add overlayitem's to the map. These items are clickable and you can implement the click handler in the OverlayItem extending class that you provide/add. That'll work for tapping on an OverlayItem. It will not work for tapping on arbitrary spots on the map, though. I haven't tried doing that. I recommend his books. He responds here a lot and has his own forum and weekly chats as well. Well worth $40. Thanks! -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 2.8 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] getting clicks on a map view
Kevin Duffey wrote: Using Mark Murphy's online books, he describes how to do this. I don't know if it is the only way, but basically you extend ItemizedOverlayOverlayItem, in the constructor you do the items.add(OverlyaItem) method call. This will add overlayitem's to the map. These items are clickable and you can implement the click handler in the OverlayItem extending class that you provide/add. That'll work for tapping on an OverlayItem. It will not work for tapping on arbitrary spots on the map, though. I haven't tried doing that. yeah, as i might have said ;-) i tried overlayitem.onTap() etc and got nowhere. supposedly as you say it will trap a click on the item in the overlay, but it didn't work for me. however, i made a mistake in my code, and found that subclassing MapView and overriding onTouchEvent() actually works. it's quite a heavy-handed way of doing it, as i don't have much facility for selectively filtering events. eh, ok i could mock up my own retroactive ACTION_DOWN in the situation where the drag goes outside my slop allowance, but that seems very messy... thanks all -- jason.vp.engineering.particle -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] getting clicks on a map view
Glad it worked out. Curious.. the overlayitem stuff seems to work pretty well.. why would you need to be able to control clicks directly on the map at any point, instead of providing overlayitems? On Thu, Jan 14, 2010 at 3:28 PM, Jason Proctor jason.android.li...@gmail.com wrote: Kevin Duffey wrote: Using Mark Murphy's online books, he describes how to do this. I don't know if it is the only way, but basically you extend ItemizedOverlayOverlayItem, in the constructor you do the items.add(OverlyaItem) method call. This will add overlayitem's to the map. These items are clickable and you can implement the click handler in the OverlayItem extending class that you provide/add. That'll work for tapping on an OverlayItem. It will not work for tapping on arbitrary spots on the map, though. I haven't tried doing that. yeah, as i might have said ;-) i tried overlayitem.onTap() etc and got nowhere. supposedly as you say it will trap a click on the item in the overlay, but it didn't work for me. however, i made a mistake in my code, and found that subclassing MapView and overriding onTouchEvent() actually works. it's quite a heavy-handed way of doing it, as i don't have much facility for selectively filtering events. eh, ok i could mock up my own retroactive ACTION_DOWN in the situation where the drag goes outside my slop allowance, but that seems very messy... thanks all -- jason.vp.engineering.particle -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] getting clicks on a map view
because my MapView is embedded in a much more complex view that's inside a scroller. rather than fight the ScrollView by allowing clicks in the embedded map, i just trap clicks on it and open up the Maps application. Glad it worked out. Curious.. the overlayitem stuff seems to work pretty well.. why would you need to be able to control clicks directly on the map at any point, instead of providing overlayitems? On Thu, Jan 14, 2010 at 3:28 PM, Jason Proctor mailto:jason.android.li...@gmail.comjason.android.li...@gmail.com wrote: Kevin Duffey wrote: Using Mark Murphy's online books, he describes how to do this. I don't know if it is the only way, but basically you extend ItemizedOverlayOverlayItem, in the constructor you do the items.add(OverlyaItem) method call. This will add overlayitem's to the map. These items are clickable and you can implement the click handler in the OverlayItem extending class that you provide/add. That'll work for tapping on an OverlayItem. It will not work for tapping on arbitrary spots on the map, though. I haven't tried doing that. yeah, as i might have said ;-) i tried overlayitem.onTap() etc and got nowhere. supposedly as you say it will trap a click on the item in the overlay, but it didn't work for me. however, i made a mistake in my code, and found that subclassing MapView and overriding onTouchEvent() actually works. it's quite a heavy-handed way of doing it, as i don't have much facility for selectively filtering events. eh, ok i could mock up my own retroactive ACTION_DOWN in the situation where the drag goes outside my slop allowance, but that seems very messy... thanks all -- jason.vp.engineering.particle -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to mailto:android-developers@googlegroups.comandroid-developers@googlegroups.com To unsubscribe from this group, send email to mailto:android-developers%2bunsubscr...@googlegroups.comandroid-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=enhttp://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- jason.vp.engineering.particle -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en