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 7989971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:53:02+00:00 2026-06-04T12:53:02+00:00

I wonder if there is a chance to set a final Overlay in Google

  • 0

I wonder if there is a chance to set a final Overlay in Google Maps. I wanna set my cross hairs this way, so that it isn’t moving while zooming.

Code:

        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.map_view);
            initData();

            mapView = (MapView) findViewById(R.id.mapView);

            mapView.setSatellite(true);
            mapView.setTraffic(true); 
            mapView.setBuiltInZoomControls(true);

            controller = mapView.getController();
            controller.animateTo(coordinate);
            controller.setZoom(18);

    // TODO:
            CrossHairsOverlay chOverlay = new CrossHairsOverlay();

    // Pin
            MapOverlay mapOverlay = new MapOverlay();
            mapOverlay.setPointToDraw(coordinate);

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

Cross hairs:

    public class CrossHairsOverlay extends Overlay {

        public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) {
            super.draw(canvas, mapView, shadow);
            Projection projection = mapView.getProjection();
            Point centerPoint = projection.toPixels(mapView.getMapCenter(), null);

            Bitmap crossHairs = BitmapFactory.decodeResource(getResources(), R.drawable.cross_hair);
            canvas.drawBitmap(crossHairs, centerPoint.x - (int)(27 * dpi + 0.5f), centerPoint.y - (int)(27 * dpi + 0.5f), new Paint());
            return true;
        }
    }

If I use it this way, it recenters after zooming is finished. Left/right draging works correct. I don’t really wanna set a “ZoomListener” and redraw all the time. I hope there is a bether solution to do this.

Thanks

  • 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-04T12:53:03+00:00Added an answer on June 4, 2026 at 12:53 pm

    Forgive me for not fully understanding your question…

    But, to draw to a simple point no need to use the projection, just draw your bitmap strictly to the center of the mapview.

    ie…

    // make the coordinated constant also.

    canvas.drawBitam(bitmap, center.x-(imageWidth/2), center.y-(imageHeight/2),new Paint());

    where center.x and center.y are just equal to

    Point center = new Point(canvas.getWidth()/2,canvas.getHeight()/2);

    Also dont reload your bitmap on every onDraw!, memory leak ftl ;).

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

Sidebar

Related Questions

I just wonder there a way to display the files in document directory with
I wonder if there is better way to get max from column c1 and
I wonder if there is a way to use zipcode instead of Lat and
I wonder if there is a way to extract a resource file packaged in
I wonder if there's any way to do a while loop in django (I
I wonder if there is a way to recognize the visit from user's iphone
I wonder if there exists way to work with large files in Mathematica ?
I wonder whether there is a mercurial command/extension that just tests whether a given
There seems to be an delegate that can be set like myView.layer.delegate = anObject
I wonder there might be a built-in feature in Groovy, something like aCollection.doEachBulk(100) {

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.