by insanomania911 » Tue Jun 09, 2009 4:58 pm
I tried your code and other codes as well , I can't seem to make this work.
All I need is to click on my map and have some sort of a listener trigger like a popup window,dialog or Toast giving the user the long/lat. It just doesn't work. I have my MapView created in my xml main layout fle where I set android:clickable="true" and android:enabled="true"
Also I have the following code:
class MapOverlay extends com.google.android.maps.Overlay
{
@Override
public boolean onTouchEvent(MotionEvent event, MapView mapView)
{
System.out.println("reached here 2 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
//---when user lifts his finger---
if (event.getAction() == MotionEvent.ACTION_UP) {
GeoPoint p = mapView.getProjection().fromPixels(
(int) event.getX(),
(int) event.getY());
Toast.makeText(getBaseContext(),
p.getLatitudeE6() / 1E6 + "," +
p.getLongitudeE6() /1E6 ,
Toast.LENGTH_SHORT).show();
System.out.println("Touched this loc: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"+p);
}
return false;
}
}
what am I doing wrong? because I am not getting anything.
thanks.