I simply want a mapview to recognize a click, in order to call another activity.
Until now, i tried the regular \"onClick\",that always worked for me in regular View
Add an Overlay in your map view and handle the OnTouchEvent. Try something like this:
public class MyMapActivity extends MapActivity {
class MapOverlay extends com.google.android.maps.Overlay
{
@Override
public boolean onTouchEvent(MotionEvent e, MapView mapView)
{
if (e.getAction() == MotionEvent.ACTION_UP) {
GeoPoint p = mapView.getProjection().fromPixels(
(int) e.getX(),
(int) e.getY());
MyMapActivity this.startActivityForResult(intent, requestCode);
}
return false;
}
}
// MyMapActivity methods
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mapView = (MapView) findViewById(R.id.mapview);
MapOverlay mapOverlay = new MapOverlay();
List listOfOverlays = mapView.getOverlays();
listOfOverlays.clear();
listOfOverlays.add(mapOverlay);
}
}