Hi everyone, I want to override the method enableMyLocation() in MyLocationOverlay class, in order to implement my own positioning algorithm to get latitude/longitude, and then plot them onto a MapView.
I figured out how to do that, but now I'm stuck because I dont know what Canvas to pass when I call the method drawMyLocation(). Here is the MyLocationOverlay class: public class LocationOverlay extends MyLocationOverlay implements LocationListener,GpsStatus.Listener{ Bitmap circleIcon; private MapView mapView; private OutdoorMap outdoorMap; private Context context; private LocationManager locationManager; public LocationOverlay(Context context, MapView mapView) { super(context, mapView); this.mapView = mapView; this.context = context; circleIcon = BitmapFactory.decodeResource(context.getResources(),R.drawable.circle); } @Override public boolean enableMyLocation() { locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); start(); return true; } @Override public void onLocationChanged(Location loc) { // Here want to call drawMyLocation but I dont know what Canvas to pass to it this.drawMyLocation(canvas, mapView, loc, new GeoPoint((int) (loc.getLatitude()*1000000) ,(int)(loc.getLongitude()*1000000)), loc.getTime()); } public void start() { // Register for location updates. LocationProvider prov = locationManager.getProvider(LocationManager.GPS_PROVIDER); if (prov != null) { locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this); locationManager.addGpsStatusListener((Listener) this); Location prime = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); } } public void stop() { LocationProvider prov = locationManager.getProvider(LocationManager.GPS_PROVIDER); if (prov != null) locationManager.removeUpdates(this); } @Override public void onGpsStatusChanged(int event) { } } Thanks very much for your help. Cheers -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en