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.