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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:42:31+00:00 2026-05-22T00:42:31+00:00

I am working on an app for which I need a path to be

  • 0

I am working on an app for which I need a path to be drawn on a Google map as the location changes showing where the user has been. I have tried using the MyLocationOverlay class thinking I could just override the method that draws the location but I have been unsuccessful in determining what method to override. Also, it appears that MyLocationOverlay draws a new map every time the location is drawn. I am currently using an ItemizedOverlay and just having a dot added to the list every time the location changes. This works, and I get a dotted path as I walk but I would really like a solid path. Are there any suggestions?

I have also seen this post but I can’t get it to work. Dont you need an overlay inorder to get it on the map?

  • 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-05-22T00:42:32+00:00Added an answer on May 22, 2026 at 12:42 am

    I think the easiest way to do this would be to subclass the Overlay class, and then override the draw method. The draw method is pretty open ended and it shouldn’t be too hard to draw a path. An example would look something like this:

    public class PathOverlay extends Overlay{
    
        private List<GeoPoint> gpoints;
    
        public PathOverlay(List<GeoPoint> gpoints){
            this.gpoints = gpoints;
        }
    
        @Override
        public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) 
        {
            List<Point> mpoints = new ArrayList<Point>();
    
            // Convert to a point that can be drawn on the map.
            for(GeoPoint g : gpoints){
                Point tpoint = new Point();
                mapView.getProjection().toPixels(g, tpoint);
                mpoints.add(tpoint);
            }
    
            Path path = new Path();
    
            // Create a path from the points
            path.moveTo(mpoints.get(0).x, mpoints.get(0).y);
            for(Point p : mpoints){
                path.lineTo(p.x, p.y);
            }
    
            Paint paint = new Paint();
            paint.setARGB(255, 255, 0, 0);
            paint.setStyle(Style.STROKE);
            // Draw to the map
            canvas.drawPath(path,paint);
    
            return true;
    
        }
    }
    

    Objects of this class can then be added to the list returned by MapView.getOverlays() to be added to the map.

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

Sidebar

Related Questions

I have an MFC app which I have been working on for a few
i am working on a simple web app which has a user model and
I am working on an app in which user have to send an email,
I am working on a C++ app which internally has some controller objects that
I work on a app which has only one way to get a working
I'm working at an app which would make a POST ajax request to a
I'm working on a web app which is heavy on the client side, which
I am working on an Adobe Flex app, which needs to parse a relativley
I have build an C# Winforms application which will need regular updates and patches
i have an RoR application Log, which similar to the book store app, my

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.