Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9223595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:06:41+00:00 2026-06-18T04:06:41+00:00

I am trying to draw few circles within circle and show them on the

  • 0

I am trying to draw few circles within circle and show them on the Google maps. And current location should be at the center of all the circles. Means in the middle of the circle.

Everything is working fine. But somehow my marker is not getting displayed at the center of all the circles. Marker size is 36 by 36.

I tried few hit and trials but still the same problem. Is there any way I can place the marker at the center of all the circumcircles? What is the problem with my code because of that it is not showing in the center of circle? May be the way I am drawing circle is not right?

@Override
    public void onLocationChanged(Location location) {
        if (location != null) {
        GeoPoint point = new GeoPoint((int) (location.getLatitude() * 1E6),
            (int) (location.getLongitude() * 1E6));

        mapController.animateTo(point);
        mapController.setZoom(15);

        if (mapOverlay == null) {
            mapOverlay = new MapOverlay(this, R.drawable.mark_blue);

            List<Overlay> listOfOverlays = mapView.getOverlays();
            listOfOverlays.add(mapOverlay);
        }

        mapOverlay.setPointToDraw(point);
        mapView.invalidate();
        }
    }

Below is my MapOverlay class in which I am drawing circle within circle

class MapOverlay extends Overlay {
    private GeoPoint pointToDraw;
    int[] imageNames = new int[6];
    private Point mScreenPoints;
    private Bitmap mBitmap;
    private Paint mCirclePaint;

    public MapOverlay(GPSLocationListener gpsLocationListener, int currentUser) {
        imageNames[0] = currentUser;
        imageNames[1] = R.drawable.tenm;
        imageNames[2] = R.drawable.twentym;
        imageNames[3] = R.drawable.thirtym;
        imageNames[4] = R.drawable.fourtym;
        imageNames[5] = R.drawable.fiftym;

        mCirclePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mCirclePaint.setColor(0x10000000);
        mCirclePaint.setStyle(Style.FILL_AND_STROKE);
        mBitmap = BitmapFactory.decodeResource(getResources(), imageNames[0]);
        mScreenPoints = new Point();
    }

    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);
        mScreenPoints = mapView.getProjection().toPixels(pointToDraw, mScreenPoints);

        int totalCircle = 5;
        int radius = 40;
        int centerimagesize = 13;

        for (int i = 1; i <= totalCircle; i++) {
        canvas.drawCircle(mScreenPoints.x, mScreenPoints.y, i * radius, mCirclePaint);
        canvas.drawBitmap(BitmapFactory.decodeResource(getResources(), imageNames[i]),
            ((mScreenPoints.x) + (i * radius)), (mScreenPoints.y), null);
        }

        canvas.drawBitmap(mBitmap, (mScreenPoints.x - (centerimagesize / 2)),
            (mScreenPoints.y - (centerimagesize / 2)), null);
        super.draw(canvas, mapView, shadow);

        return true;
        }
    }

Below is the screenshot from my communicator as well in which you can clearly see, it is not coming in the center of circle-

enter image description here

Can anyone provide some thoughts on this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T04:06:42+00:00Added an answer on June 18, 2026 at 4:06 am

    It looks to me like the top-left corner of the marker graphic is in the centre of the circle. So you need to adjust the marker position by the displacement from the top-left corner to the actual point of the marker. I guess that would be 18 horizontally and 36 vertically.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to draw a circle after a few calculations are performed over
I'm trying to draw a few images on a canvas, to make sure the
Why when I want to draw a polyline using Google maps V3.0 (JavaScript API)
I'm trying to create an element within a ListView which displays a few TextViews
I've been trying to use a few different gems for displaying googlemaps within rails
I am trying to draw a waveform. I have a precalculated amount of datapoints
I am trying to draw a line along with mouse move on a paper.
I am trying to draw in a web worker using html5 canvas. The worker
I'm trying to draw custom UI (a path in this case) on top of
I'm trying to draw a semi-transparent rectangle on top of an image to act

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.