Porting a Google Maps app to Osmdroid - problem with overlay
<p>I'm porting a Google Maps based project to Osmdroid in order to use OpenStreetMaps. The port is working OK apart from adding my overlay which consists of a number of straight lines and some text. In both projects I add the Overlay by means of a timer thread and handler calling redrawOverlay.</p>

<p>In the OSM project my overlay is just a grey square completely hiding the map. If I remove the call to redrawOveraly, the OSM tiles are shown OK. I've reduced the overlay code to the bare minimum of a single diagonal line in the code samples below. It works fine in the Google app, overlaying the map tile. The com.google.android.maps.Overlay has a draw method, the OSM has an onDraw, so I have in the OSM version:</p>

<pre><code>   private MapView mv;
   private MapOverlay mmapOverlay = null;

   private void redrawOverlay() {

   gPt = mv.getMapCenter();
   if (mmapOverlay == null)
      mmapOverlay = new MapOverlay(getApplicationContext());
      List&lt;Overlay&gt; listOfOverlays = mv.getOverlays();
      listOfOverlays.clear();
      listOfOverlays.add(mmapOverlay);
      mv.invalidate();
   }

   public class MapOverlay extends org.osmdroid.views.overlay.Overlay {

   public MapOverlay(Context ctx) {
      super(ctx);
      // TODO Auto-generated constructor stub
   }

      @Override
      public void onDraw(Canvas canvas, MapView mapView) {

      Paint lp3;
      lp3 = new Paint();
      lp3.setColor(Color.RED);
      lp3.setAntiAlias(true);
      lp3.setStyle(Style.STROKE);
      lp3.setStrokeWidth(1);
      lp3.setTextAlign(Paint.Align.LEFT);
      lp3.setTextSize(12);
      canvas.drawLine(10, 10, 150, 150, lp3);
   }
</code></pre>

<p>Whilst in the Google maps original I have the equivalent :</p>

<pre><code>  public class MapOverlay extends com.google.android.maps.Overlay {


   @Override
   public boolean draw(Canvas canvas, MapView mapView, boolean shadow,
   long when) {
      super.draw(canvas, mapView, shadow);
      Paint lp3;
      lp3 = new Paint();
      .....etc.
</code></pre>

<p>redrawOverlay is the same except the instantiation of the overlay is just:</p>

<pre><code>mmapOverlay = new MapOverlay();
</code></pre>

<p>All suggestions will be gratefully received</p>

<p><strong>UPDATE Question for kurtzmarc:</strong></p>

<p>Thanks for you help so far, I see that you are one of the authors of Osmdroid. I like what it's doing so far. I would like to suppress the 'jump to and zoom in' that you get on double tap. I'd like it to do nothing at all. I think it's probably hitting this bit in your source and doing the zoomInFixing:</p>

<pre><code>private class MapViewDoubleClickListener implements GestureDetector.OnDoubleTapListener {
   @Override
   public boolean onDoubleTap(final MotionEvent e) {
   for (int i = mOverlays.size() - 1; i &gt;= 0; i--)
      if (mOverlays.get(i).onDoubleTapUp(e, MapView.this))
         return true;

      final GeoPoint center = getProjection().fromPixels(e.getX(), e.getY());
      return zoomInFixing(center);
  }
</code></pre>

<p>It doesn't seem that I can override it. I'm using the 3.0.1 jar and the associated javadocs. I'm wondering if the Mapview's setTouchDelegate method would help, but there is no reference to it in the javadocs. Have you any suggestions please?</p>
