Additional callbacks that can be received for
Called when the application needs to redraw the content of its surface, after it is resized or for some other reason.
An alternative to surfaceRedrawNeeded where it is not required to block until the redraw is complete.
void surfaceRedrawNeeded (SurfaceHolder holder)
Called when the application needs to redraw the content of its
surface, after it is resized or for some other reason. By not
returning from here until the redraw is complete, you can ensure that
the user will not see your surface in a bad state (at its new
size before it has been correctly drawn that way). This will
typically be preceeded by a call to
surfaceChanged(SurfaceHolder, int, int, int).
As of O,
surfaceRedrawNeededAsync(SurfaceHolder, Runnable) may be implemented
to provide a non-blocking implementation. If
is not implemented, then this will be called instead.
void surfaceRedrawNeededAsync (SurfaceHolder holder, Runnable drawingFinished)
An alternative to surfaceRedrawNeeded where it is not required to block
until the redraw is complete. You should initiate the redraw, and return,
later invoking drawingFinished when your redraw is complete.
This can be useful to avoid blocking your main application thread on rendering.
As of O, if this is implemented
surfaceRedrawNeeded(SurfaceHolder) will not be called.
However it is still recommended to implement
compatibility with older versions of the platform.