Best practice for DataField

Hi,

Like most people, I'm lazy enough to use the patterns in the supplied sample projects until I have a reason to change them. Which means, for DataField, I've pretty much used initialize(), onLayout(), compute() and onUpdate() with onTimerLap() only when I started caring about lap events.

But is that the best practice for more complex functioning?

Specifically, the thing that triggered this thread was an issue with Edge not resetting display as it was able to keep the same DataField instance despite transitioning between activities in a way that doesn't appear to be the case for watches (which seem, though don't quote me, to reinitialise the field for each new activity).

So, the question is;

Is the recommended simple method set enough?

For example: if my DataField is a FitContributor is it OK just to initialise the fields during initialize() and to then forget them? Or should I be rebuilding new fields to accept new data after onTimerReset() ?

G

  • And on a related subject, can I use this to help peak memory for Application.setProperty()?

    For example, I have a number of apps that try to .setProperty() in response to parsing a key from users. If the parsing fails, I use .setProperty() to  make sure users know because I replace the key with "CHECK~" prepended and if successful, I replace the key with a success message.

    But...

    .setProperty balloons the peak memory as it needs to read the whole thing into and then out of memory.

    My understanding is that the actual file write occurs at the end of the DataField / App / Widget life cycle - eg: when the app closes.

    Can I do a major clean up before the close event to give myself enough memory to allow this to happen and still ensure full functionality by more intelligent use of the "onTimer*" functions?