The CanvasWatchFaceService.Engine
class extends the WatchFaceService.Engine
class. Here, actual implementation of a watch face that draws on a canvas can be accomplished. We ought to implement onCreateEngine()
to reestablish your concrete engine implementation. CanvasWatchFaceService.Engine
has one public constructor with a couple of procedures to us to implement the watch face. How about we examine a couple of methods that we will in the later bit of this chapter:
void invalidate ()
: Plans a call toonDraw(Canvas, Rect)
to draw the following frame. This must be approached on the main thread.void onDestroy ()
: In this callback, we can the hardware and other resources that we would be using to complete the watch face.void onDraw(Canvas canvas, Rect bounds)
: Draws the face, all the visual components, and clock revive rationale, and other clock arrangements are accomplished in this method.void onSurfaceChanged()
: This takes four params,void onSurfaceChanged...