In SurfaceView
is not necessary, in View
it is because is your chance to get a reference to the canvas, so you can add extra shapes/Bitmaps to the view, however surface view has a powerful complementary class, SurfaceHolder
which has a lockCanvas
method that returns a reference to the canvas of the surface view (without having to override onDraw
) and most importantly, using lockCanvas
you can do all the drawing and processing of your shapes/bitmaps ASYNCHRONOUSLY(with unlockCanvasAndPost
to publish your changes), unlike onDraw
which depends on the main thread and invalidation of the view to be executed...
Hope it helps.
Regards