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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:06:46+00:00 2026-06-13T00:06:46+00:00

I have a question regarding the draw() method of the Overlay class in Android

  • 0

I have a question regarding the draw() method of the Overlay class in Android Maps.

When I move map, method draw() get called a few times (from 4 to 13). It’s a problem for me, because this method must repaint my route with 70000+ points, and this is a lot resources.

I can’t find description for this problem, but when I use code examples from any sources, I have same problem.

  • 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-13T00:06:46+00:00Added an answer on June 13, 2026 at 12:06 am

    This is the normal behaviour. When you move the map, you expect it to move smoothly and to achive that any map movement is slipt in smaller movement steps.

    For the sake of consitency, the draw() method on the overlay is called for each of this small steps movement, so you can reposition your overlay items to follow each os this steps.

    You can improve it using the following:

    Improvement 1

    For each of the small steps, onDraw is called twice. One with shadow parameter equal to trueand one equal to false. If you are not drawing shadows you can just ignore one of the calls, and therefore reduce the overhead by 2, using the following as the first line of onDraw():

    if(shadow) return;
    

    Improvement 2

    Optimize the way you are drwaing the route. If you are using canvas.drawLine() you can definitly improve it by using canvas.drawPath(). You create a path with your route just once (for a specific zoom level) and when the map is moved you just offset the path, without the need to recreat it.

    Improvement 3

    You can even optimize further the path, only adding points that have a distance from previous pixel bigger a speciffic value (i.e. 2 pixels), reducing the total number of points in the path without any visible loss of quality.

    I’m using the approach above with routes of several thousand points (aprox 20.000) and the route move smoothly in a medium range device.

    Let me know if you need more details in any of the above points.

    good luck.

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

Sidebar

Related Questions

i have a question regarding the AsyncTask class in android, and why it is
I have question regarding the SQLAlchemy. How can I add into my mapped class
I have question regarding disabling browser caching. I have already found few solutions, and
I am new to Android development and I have a question regarding custom views
I have a question regarding parsing data from Wikipedia for my Android app. I
I have question regarding macros. How could I cast through macro a template class
I have question regarding the use of function parameters. In the past I have
I have a question regarding applying a RTRIM on a ASP:Hyperlink statement. The code
I have a question regarding the proper way to modify a php DateTime object.
I have a question regarding the best practise of handling formated text when using

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.