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:
Using java Syntax Highlighting
- 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;
- }
- }
Parsed in 0.011 seconds, using GeSHi 1.0.8.4
what am I doing wrong? because I am not getting anything.
thanks.