When is onLayout() called for a watchface?

In an attempt to limit the number of operations done in onUpdate(), I only call dc.clear() in onLayout() and once per day in onUpdate(). On my watch (enduro 3) this works fine, I use a black background when I call drawText(), so I never get old text showing up, and I think the watchface is totally rebuilt when I go to other menus and back to the watchface. But on an Epix Pro, it doesn't by default clear the display after exiting menus, so the old menu can show up behind the text, at least until the screen goes to sleep and then wakes up again. I know the solution is to simply call dc.clear() in onUpdate(), but the docs say "onLayout() is called before the View is shown to load resources and set up the layout of the View", so I assumed it was safe to assume it could be called only in onLayout() and once per day.

  • onLayout will be called once when the WF starts, before the first call to onUpdate.

    You want to do the dc.clear() and redraw everything each time onUpdate() is called.  Different watches are different.  Some clear the dc for you, others don't and you will not see this in the sim.

    On MIP watches, you can update part of the screen when using onPartialUpdate.  It's not available on AMOLED watches.