public class

CanvasWatchFaceService.Engine

extends WatchFaceService.Engine

Note: The Wearable Support Library classes under the android.support.wearable package are subject to change. For the full Android API reference, see Reference.

java.lang.Object
   ↳ android.service.wallpaper.WallpaperService.Engine
     ↳ android.support.wearable.watchface.WatchFaceService.Engine
       ↳ android.support.wearable.watchface.CanvasWatchFaceService.Engine

Class Overview

The actual implementation of a watch face that draws on a Canvas. You must implement onCreateEngine() to return your concrete Engine implementation.

Summary

Public Constructors
CanvasWatchFaceService.Engine()
Public Methods
void invalidate()
Schedules a call to onDraw(Canvas, Rect) to draw the next frame.
void onDestroy()
void onDraw(Canvas canvas, Rect bounds)
Draws the watch face.
void onSurfaceChanged(SurfaceHolder holder, int format, int width, int height)
void onSurfaceCreated(SurfaceHolder holder)
void onSurfaceRedrawNeeded(SurfaceHolder holder)
void postInvalidate()
Posts a message to schedule a call to onDraw(Canvas, Rect) to draw the next frame.
[Expand]
Inherited Methods
From class android.support.wearable.watchface.WatchFaceService.Engine
From class android.service.wallpaper.WallpaperService.Engine
From class java.lang.Object

Public Constructors

public CanvasWatchFaceService.Engine ()

Public Methods

public void invalidate ()

Schedules a call to onDraw(Canvas, Rect) to draw the next frame. Must be called on the main thread.

public void onDestroy ()

public void onDraw (Canvas canvas, Rect bounds)

Draws the watch face.

Parameters
canvas the canvas to draw into
bounds the bounds in which the watch face should be drawn

public void onSurfaceChanged (SurfaceHolder holder, int format, int width, int height)

public void onSurfaceCreated (SurfaceHolder holder)

public void onSurfaceRedrawNeeded (SurfaceHolder holder)

public void postInvalidate ()

Posts a message to schedule a call to onDraw(Canvas, Rect) to draw the next frame. Unlike invalidate(), this method is thread-safe and may be called on any thread.