In Android MapsDemo, available in Eclipse for the Google APIs, they create an inner class SmoothCanvasin MapViewCompassDemo.java. Within this class, reimplement each seemingly apparent method and redirect it to the delegate instance Canvas.
static final class SmoothCanvas extends Canvas {
Canvas delegate;
private final Paint mSmooth = new Paint(Paint.FILTER_BITMAP_FLAG);
public void setBitmap(Bitmap bitmap) {
delegate.setBitmap(bitmap);
}
public void setViewport(int width, int height) {
delegate.setViewport(width, height);
}
...
What is the point of the delegate in this case?
source
share