Code example for GestureDetector

    private OnMapDragListener onDragListener;
    private final MapsforgeMapController mapController = new MapsforgeMapController(getController(), getMaxZoomLevel());
    public MapsforgeMapView024(Context context, AttributeSet attrs) {
        super(context, attrs);
        gestureDetector = new GestureDetector(context, new GestureListener());
    public void draw(Canvas canvas) {
        try { 
            // Google Maps and OSM Maps use different zoom levels for the same view. 
            // Here we don't want the Google Maps compatible zoom level, but the actual one. 
            if (getActualMapZoomLevel() > 22) { // to avoid too close zoom level (mostly on Samsung Galaxy S series) 
        } catch (Exception e) {
            Log.e("MapsforgeMapView024.draw", e);
Stop searching for code, let great code find you!  Add Codota to your java IDE