I have searched around on how to get the coordinates of a location when the map is tapped. However, most, if not all the examples require a MapView
as a parameter. For example:
public boolean onTap(GeoPoint p, MapView map){
if ( isPinch ){
return false;
}else{
Log.i(TAG,"TAP!");
if ( p!=null ){
handleGeoPoint(p);
return true; // We handled the tap
}else{
return false; // Null GeoPoint
}
}
}
@Override
public boolean onTouchEvent(MotionEvent e, MapView mapView)
{
int fingers = e.getPointerCount();
if( e.getAction()==MotionEvent.ACTION_DOWN ){
isPinch=false; // Touch DOWN, don't know if it's a pinch yet
}
if( e.getAction()==MotionEvent.ACTION_MOVE && fingers==2 ){
isPinch=true; // Two fingers, def a pinch
}
return super.onTouchEvent(e,mapView);
}
How do I therefore get the location of a tapped position on the map with MapFragment
and not MapView
?