Return to Snippet

Revision: 58611
at July 24, 2012 23:05 by l01241

Initial Code
private class MyOverlay extends Overlay {
		private GeoPoint center;
		private float radius;
		private Paint cPaint;

		public MyOverlay(GeoPoint c) {
			center = c;
			radius = 20;
			cPaint = new Paint();

		public void draw(Canvas canvas, MapView mapView, boolean shadow) {
			super.draw(canvas, mapView, shadow);
			if (shadow == false) {
				// class exercise
				// Step 1: get pixel coordinate of center (in GeoPoint)			
				Point screenPt = new Point();
				mapView.getProjection().toPixels(center, screenPt);
				// Step 2: draw a circle at the converted pixel coordinate
				canvas.drawCircle(screenPt.x, screenPt.y, radius, cPaint);


Initial URL

Initial Description

Initial Title
Android MyOverlay extends Overlay

Initial Tags

Initial Language