Circle within Circle in Android
This is my Below code which only draws one Circle around Current Location as the center. I need to draw a Circle within Circle around the current location on the google map. Total circle should be 5. Radius of each circle should be like this-
Code:
Circle 1 radius should be 10m
Circle 2 radius should be 20m
Circle 3 radius should be 30m
Circle 4 radius should be 40m
Circle 5 radius should be 50m
Below code works fine to create only one circle by taking the current location as the center. But how can I draw other circles with the above specification.
Code:
class MapOverlay extends Overlay {
private GeoPoint pointToDraw;
public void setPointToDraw(GeoPoint point) {
pointToDraw = point;
}
public GeoPoint getPointToDraw() {
return pointToDraw;
}
@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(pointToDraw, screenPts);
//--------------draw circle----------------------
Point pt = mapView.getProjection().toPixels(pointToDraw,screenPts);
Paint circlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
circlePaint.setColor(0x30000000);
circlePaint.setStyle(Style.FILL_AND_STROKE);
canvas.drawCircle(screenPts.x, screenPts.y, 130, circlePaint);
//---add the marker---
Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.current_user);
canvas.drawBitmap(bmp, screenPts.x, screenPts.y-bmp.getHeight(), null);
super.draw(canvas,mapView,shadow);
return true;
}
}
I am having hard time making other circles by taking current location as the center. R.drawable.current_user is the current location