keep state across invocations - Printable Version +- PINE64 (https://forum.pine64.org) +-- Forum: PineTime (https://forum.pine64.org/forumdisplay.php?fid=134) +--- Forum: Development Discussion on PineTime (https://forum.pine64.org/forumdisplay.php?fid=136) +--- Thread: keep state across invocations (/showthread.php?tid=19482) |
keep state across invocations - lmamane - 10-31-2024 In InfiniTime, is there a way for my screen (app) to maintain some state across invocations? E.g. for app settings, but also for a stopwatch/timer that can resume even if the user switched to another screen and back. I would just store the time point at which the stopwatch/timer started, and then recompute the elapsed/remaining time from the current time point when it is reopened. RE: keep state across invocations - lmamane - 11-01-2024 I managed to do it by adding a new controller just for my app, taking inspiration from the Timer app. The controllers implementations live in src/components, the structure that holds them all is in src/displayapp/Controllers.h, and they are created / stored by src/displayapp/DisplayApp.{h,cpp} |