how to implement on click functionality on Map Overlay?

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

how to implement on click functionality on Map Overlay?

Postby mr_muskuraha » Mon Feb 08, 2010 3:10 pm

dear friends,

i have pointed out a location on google map...
using mapoverlay


now i want to show dialog on clicking that perticular overlay can any one guide me how to achieve this..???

any help would be appriciated...
mr_muskuraha
Senior Developer
Senior Developer
 
Posts: 142
Joined: Wed Jan 13, 2010 8:49 am

Top

Postby thetuxracer » Fri Feb 12, 2010 10:10 am

hi, even im trying to do the same, but using longClick. google doesnt throw up many results, and its been a frustrating 3 hours, trying to run a function, when i longpress on a MapView.
thetuxracer
Developer
Developer
 
Posts: 26
Joined: Mon Jan 04, 2010 7:59 am
Location: Nashik, MH, India

Postby nicholas.hauschild » Fri Feb 12, 2010 2:00 pm

Hello mr_muskuraha,

I am assuming that you are extending the ItemizedOverlay<T> object to manage your Overlays. Well, this class provides a hook which gives the ability to handle touches to any of the OverlayItem's in your ItemizedOverlay<T>.

public boolean onTap(GeoPoint point, MapView mapView)

GeoPoint point -- the location on the map of the 'tapped' Overlay.
MapView mapView -- the MapView on which the Overlay resides.

If you are not extending ItemizedOverlay<T>, could you let me know what you are using, and I will see if I can help.

Good luck!
-Nick
nicholas.hauschild
Master Developer
Master Developer
 
Posts: 310
Joined: Fri Dec 04, 2009 4:50 am

Postby thetuxracer » Thu Mar 04, 2010 10:40 am

just make sure you set bounds, if there are more than one overlays.
thetuxracer
Developer
Developer
 
Posts: 26
Joined: Mon Jan 04, 2010 7:59 am
Location: Nashik, MH, India

Postby guruzen » Wed Mar 10, 2010 5:05 am

Listen for onTouch Event instead of onTap. onTouch works perfectly on an actual device and onTap works on emulator.
guruzen
Junior Developer
Junior Developer
 
Posts: 23
Joined: Wed Jan 13, 2010 5:23 am

ok

Postby mr_muskuraha » Wed Mar 10, 2010 6:33 am

thanks you very much guys for your support.
mr_muskuraha
Senior Developer
Senior Developer
 
Posts: 142
Joined: Wed Jan 13, 2010 8:49 am

Top

Return to Map Problems

Who is online

Users browsing this forum: Google Feedfetcher and 1 guest