title: Draw A Circle On Android MapView
body: <p>Got it fixed here is my solution: </p>
  
  <p><strong>Edit:</strong> updated to reflect robguinness answer.</p>
  
  <pre><code>import com.google.android.maps.GeoPoint;
  import com.google.android.maps.MapView;
  import com.google.android.maps.Overlay;
  import com.google.android.maps.Projection;
  
  import android.content.Context;
  import android.graphics.Canvas;
  import android.graphics.Color;
  import android.graphics.Paint;
  import android.graphics.Point;
  
  public class CircleOverlay extends Overlay {
  
  Context context;
  double mLat;
  double mLon;
  float mRadius;
  
  public CircleOverlay(Context _context, double _lat, double _lon, float radius ) {
      context = _context;
      mLat = _lat;
      mLon = _lon;
      mRadius = radius;
  }
  
  public CircleOverlay(Context _context, double _lat, double _lon, float radius ) {
      context = _context;
      mLat = _lat;
      mLon = _lon;
      mRadius = radius;
  }
  
  public void draw(Canvas canvas, MapView mapView, boolean shadow) {
      super.draw(canvas, mapView, shadow); 
  
      if(shadow) return; // Ignore the shadow layer
  
      Projection projection = mapView.getProjection();
  
      Point pt = new Point();
  
      GeoPoint geo = new GeoPoint((int) (mLat *1e6), (int)(mLon * 1e6));
  
      projection.toPixels(geo ,pt);
      float circleRadius = projection.metersToEquatorPixels(mRadius) * (1/ FloatMath.cos((float) Math.toRadians(mLat)));
  
      Paint innerCirclePaint;
  
      innerCirclePaint = new Paint();
      innerCirclePaint.setColor(Color.BLUE);
      innerCirclePaint.setAlpha(25);
      innerCirclePaint.setAntiAlias(true);
  
      innerCirclePaint.setStyle(Paint.Style.FILL);
  
      canvas.drawCircle((float)pt.x, (float)pt.y, circleRadius, innerCirclePaint);
  }
  </code></pre>
  
  <p>}</p>
  
  <p><strong>To "Draw" it needs to be added to the maps overlays</strong></p>
  
  <pre><code>mMapView.getOverlays().add(new CircleOverlay(context, loc.getLatitude(),loc.getLongitude()));
  </code></pre>
  
  <p>Hope this helps.</p>