Canvas drawing using SurfaceView:
*Canvas drawing using SurfaceView
It’s important to understand the basic concept of the surface view before using:
unlockCanvasAndPost() swaps the buffers.
Deadlocks can easily occur if the lockCanvas() and unlockCanvasAndPost() methods are not called in the correct order.