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

The Archive Base Latest Questions

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

in my app i am drawing route path on map where ever i am

  • 0

in my app i am drawing route path on map where ever i am moving and pin the source and destination. so i use LocationManager class for get location update as itmyManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,new myLocationListener());. i go 10 meter distance no location update is done. so for the checking my code. i just put functionality in the onStatusChanged function(because it is called at least one time).i run the app onStatusChanged is called. what my problem is pin the source and destination and route drawing class called continuously even though the onStatusChanged is not called. and pin is not pointed and root is not drawn even though their class is called.

my code:

public class Map extends MapActivity 
  {  
    // class for pin the location 
class MapOverlay extends com.google.android.maps.Overlay
    {
      ............
      Log.e("loc","true");
    }
   public void onCreate(Bundle savedInstanceState) 
   {
      .................. 
      myManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,new myLocationListener());        
   }
@Override
protected boolean isRouteDisplayed() {
    // TODO Auto-generated method stub
    return false;
}

class myLocationListener implements LocationListener {
    public void onLocationChanged(Location loc) {       
    }
    ........
   public void onStatusChanged(String provider, int status, Bundle extras) {
     Log.e("MAP","onStatusChanged - called");
     ....// finding lat and lng getting.
     Log.e("Updated Location",""+latPointDst+" , "+lngPointDst);
      ..........
      // here i called MyOverlay class -- root drawing.
      // here i called MapOverlay class  -- pin the location
   }  

} 

 public class MyOverlay extends Overlay {
  .............
  Log.e("location change","drawing");
  }

}

my logcat:

 05-30 13:29:54.653: ERROR/MAP(3850): onStatusChanged - called
 05-30 13:29:54.673: ERROR/Updated Location(3850): 9.909228086471558 , 78.10081958770752
 05-30 13:29:54.743: ERROR/loc(3850): true
 05-30 13:29:54.783: ERROR/loc(3850): true
 05-30 13:29:54.793: ERROR/loc(3850): true
 05-30 13:29:54.803: ERROR/loc(3850): true
 05-30 13:29:54.813: ERROR/location change(3850): drawing
 05-30 13:29:54.983: ERROR/loc(3850): true
 05-30 13:29:54.993: ERROR/loc(3850): true
 05-30 13:29:54.993: ERROR/loc(3850): true
 05-30 13:29:55.003: ERROR/loc(3850): true
 05-30 13:29:55.013: ERROR/location change(3850): drawing
 05-30 13:29:55.193: ERROR/loc(3850): true
 05-30 13:29:55.203: ERROR/loc(3850): true
 05-30 13:29:55.223: ERROR/loc(3850): true
 05-30 13:29:55.233: ERROR/loc(3850): true
 05-30 13:29:55.243: ERROR/location change(3850): drawing
 05-30 13:29:55.473: ERROR/loc(3850): true
 05-30 13:29:55.483: ERROR/loc(3850): true
 05-30 13:29:55.573: ERROR/loc(3850): true
 05-30 13:29:55.603: ERROR/loc(3850): true
 05-30 13:29:55.633: ERROR/location change(3850): drawing
 05-30 13:29:55.693: ERROR/loc(3850): true

and so on.
i write class calling within on statuschanged but i do not know how is called continuously without on status changed.. . if i am wrong please assist to do my need. please help me.

  • 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-22T20:31:49+00:00Added an answer on May 22, 2026 at 8:31 pm

    I think you need to focus on 2 things here :

    1 – You shouldn’t rely on the onStatusChanged to get a recent location. The method is called when

    • the provider status changes.
    • a provider is unable to fetch a location or if the provider has recently become available after a period of unavailability.

    The only way to get up to date location changes is in onLocationChanged.

    2 – The draw method of the overlay will be called a lot. You shouldn’t rely on that method to add markers. You can add markers to your overlay outside the draw method. When you populate the overlay, or invalidate the map, any markers that you added to the overlay will be shown on the map. No need to add the markers in the draw method.

    As you can see from the accepted answer here Drawing a line/path on Google Maps, the draw() method is used to draw a path between 2 geopoints. If you want to add markers (pins) to the map, you can do it on your overlay, see this answer How to clear / reset an ItemizedOverlay in Android? for more info on how to add markers to the map.

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

Sidebar

Related Questions

I am writing a simple drawing app to get an understanding of the HTML
I'm trying to make a simple drawing app in c++, but i'm having trouble
When hosting WPF user controls within a WinForms MDI app there is a drawing
App Engine only allows you to use these formats for XMPP addresses: app-id@appspot.com anything@app-id.appspotchat.com
An app I'm writing always crashes on a clients computer, but I don't get
My app uses a WebRequest at certain points to get pages from itself. This
I am doing a Drawing App. I have saved the color fill image as
I have been creating a drawing app as a test for WPF, and have
I have a canvas-based drawing app that when zoomed in, I draw a miniature
I'm working on a drawing app where there's a lot of textured points. Just

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.