Layouts vs on-the-fly

Hi, I was wondering if someone could layout (:p) the advantages of using layouts over computing positioning on the fly? Is there a speed advantage? If you use a layout, should you not call dc.clear in onUpdate? Thanks!
  • Former Member
    Former Member over 8 years ago
    I don't know all the pros and cons. I expect Travis might weight in with a very informative reply. What I do think is that on the fly has the potential to be faster and more responsive. You should not call dc.clear() after View.onUpdate() unless you want to wipe what was drawn with the layout.
  • From my experience:

    Layouts tend to use more memory and be slower.

    Use layouts if:
    • Your app is simple and not complex (doesn't come close to the memory limit)
    • You plan on supporting a lot of devices (easier maintenance)


    Use on the fly if:
    • Your app is complex and memory hungry
    • Performance is importance, such as preventing lagging when switching between datafields and watchface for example
    • You have some kind of abstraction in your code whereby you could load a certain class / module based on the device type.