Shouldn't it work somehow since I create a drawable and pass it to the 
OverlayItem?


latitude, longitude is known here

List<Overlay> mapOverlays = mapView.getOverlays();
ColorDrawable myCircle = new ColorDrawable();
mCirc = new Canvas();
mPaint = new Paint();
mPaint.setStyle(Paint.Style.FILL);
mPaint.setColor(0xee444444);

GeoPoint gp = new GeoPoint(latitude, longitude);
MapController mc = mapView.getController();
mc.setZoom(18);
if (mc != null) {
mc.animateTo(gp);
}

// mapView is the current mapView from MapViewActivity
Projection proj = mapView.getProjection(); 
Point mp = proj.toPixels(gp, null);

mCirc.drawCircle(mp.x, mp.y, 50, mPaint);
//myCircle.setBounds(mp.x-100, mp.y-100, mp.x+100, mp.y+100); // do I need 
this???
myCircle.draw(mCirc);

// MyItemizedOverlay is defined in the project
MyItemizedOverlay itemizedoverlay = new MyItemizedOverlay(myCircle);
OverlayItem overlayitem = new OverlayItem(gp, title, "");
itemizedoverlay.addOverlay(overlayitem);
mapOverlays.add(itemizedoverlay); 

  ----- Original Message ----- 
  From: TreKing 
  To: android-developers@googlegroups.com 
  Sent: Friday, October 29, 2010 11:02 AM
  Subject: Re: [android-developers] Drawing circle in MapView


  On Fri, Oct 29, 2010 at 1:56 AM, Hendrik Greving <fourhend...@gmail.com> 
wrote:

    The circle below doesn't show up, does anybody know why?

  Probably because you're creating your own Canvas the system knows nothing 
about.
  If you want to do custom drawing, override the onDraw or draw() methods in 
the Overlay class (I forget which it is).
  That function gets passes the Canvas object the system is drawing to and 
that's where you put your draw call.

  
-------------------------------------------------------------------------------------------------
  TreKing - Chicago transit tracking app for Android-powered devices



  -- 
  You received this message because you are subscribed to the Google
  Groups "Android Developers" group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to