I am using the MyLocationOverlay in Google Maps API and I don’t understand what canvas I should pass to drawMyLocation. Here is some of my code:
import android.content.Context;
import android.graphics.Canvas;
import com.google.android.maps.MapView;
import com.google.android.maps.MyLocationOverlay;
public class MyLocationDot extends MyLocationOverlay {
private MapView mMapView;
public MyLocationDot(Context context, MapView mapView) {
super(context, mapView);
mMapView = mapView;
}
protected void drawMyLocation(Canvas canvas) {
super.drawMyLocation(canvas, mMapView, getLastFix(), getMyLocation(), 0);
}
}
And in my onCreate() of the map activity:
// my location
myLocation = new MyLocationDot(this, mapView);
myLocation.enableMyLocation();
myLocation.runOnFirstFix(new Runnable() {
public void run() {
myLocation.drawMyLocation(WhatCanvas??);
}
});
Unless I’m wrong you don’t explicitly pass a Canvas: you pass your overlay to the MapActivity and it deals with that for you.
EDIT: so something like this.