title: Google Maps overlay image not visible
body: <p>I want to overlay a map image (.jpg) over the Google Maps mapview.
  The problem is: The overlay image is not showing, who knows what's the
  problem?</p>
  
  <p>There is no error in logcat and the MapView is working.</p>
  
  <p>The code:</p>
  
  <pre><code>package nl.ultimo.android.skikaart;
  
  import java.util.List;
  import com.google.android.maps.GeoPoint;
  import com.google.android.maps.MapActivity;
  import com.google.android.maps.MapController;
  import com.google.android.maps.MapView;
  import com.google.android.maps.Overlay;
  
  import android.graphics.Bitmap;
  import android.graphics.BitmapFactory;
  import android.graphics.Canvas;
  import android.graphics.Point;
  import android.graphics.Rect;
  import android.os.Bundle;
  
  public class MapsActivity extends MapActivity
  {
          Bitmap          bmp;    //Loaded bitmap in memory
      GeoPoint        min;    //Top left corner (lat/long)
      GeoPoint        max;    //Right bottom corner (lat/long)
  
     /** Called when the activity is first created. */
     @Override
     public void onCreate(Bundle savedInstanceState)
     {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.main);
  
         float lat1 = 45.19775f;
         float lng1 = 6.28418333f;
         float lat2 = 45.2636667f;
         float lng2 = 6.17431667f;
  
         min = new GeoPoint((int)(lat1 * 1E6), (int)(lng1 * 1E6));               // bounding rectangle
         max = new GeoPoint((int)(lat2 * 1E6), (int)(lng2 * 1E6));
  
         MapView mapView = (MapView) findViewById(R.id.mapView);
         MapController ctrl = mapView.getController();
  
         int x = (min.getLongitudeE6() + max.getLongitudeE6())/ 2;  //Select map center
         int y = (min.getLatitudeE6() + max.getLatitudeE6())/ 2;
  
         ctrl.setCenter(new GeoPoint(y,x));
         ctrl.setZoom(12);                 //Set scale
         mapView.setBuiltInZoomControls(true); //Enable zoom controls
  
         //Add overlay
         MapOverlay mapOverlay = new MapOverlay();
         List&lt;Overlay&gt; listOfOverlays = mapView.getOverlays();
         listOfOverlays.clear();
         listOfOverlays.add(mapOverlay);
  
         mapView.invalidate();
     }
  
     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);
  
             //Translate the GeoPoint to screen pixels
             Point screenPts = new Point();
             mapView.getProjection().toPixels(min, screenPts);
  
             //The overlay image
             Bitmap bmp = BitmapFactory.decodeResource(getResources(),R.drawable.skikaart);
  
             //Prepare two rectangles (pixels)
             Point top_left = new Point();
             mapView.getProjection().toPixels(min, top_left);
             Point bottom_right = new Point();
             mapView.getProjection().toPixels(max, bottom_right);
  
             Rect src = new Rect( 0,0,bmp.getWidth() - 1, bmp.getHeight() - 1 );
             Rect dst = new Rect( top_left.x, bottom_right.y,bottom_right.x,top_left.y );
  
             canvas.drawBitmap(bmp, src, dst, null);
  
             return true;
         }
     }
  
  
     @Override
     protected boolean isRouteDisplayed() {
         return false;
     }
  }
  </code></pre>