Only in the case the app dies. 1. It's reused for device orientation. 2. You can put global data anywhere you want. I often just put settings in Preferences so they will remain between executions. On Sunday, August 16, 2020 at 4:13:03 PM UTC+3 P5music wrote:
> 1-So the Codename app singleton is recreated just in what cases? > I think device orientation at least, and then? > 2-Where can I put some global data structure, in the main form I guess? > > Thanks in advance > > Il giorno sabato 15 agosto 2020 07:27:55 UTC+2, Shai Almog ha scritto: >> >> Yes. Our activity works a bit as a singleton and simplified the >> horrendous Android app life cycle. >> As a side note a few years ago in Google IO Romain Guy asked audience >> members for a show of hands if they know the Activity lifecycle. Hands were >> raised and he responded (I'm paraphrasing) "liars, I've been on the Android >> team since before it launched and I don't understand the Activity >> lifecycle". >> >> I created a relatively simple app lifecycle diagram for the Uber clone >> book. The first two chapters (which include the diagram) are a free PDF >> download from here: https://uber.cn1.co/ >> >> On Friday, August 14, 2020 at 5:36:06 PM UTC+3 P5music wrote: >> >>> My Android app is simple but it handles rotation, start from an intent >>> (cold and warm) (old intent or new), start from home, and so on. The >>> methods that are called are not always know, so sometimes more than a >>> single method are called. For example onSaveInstanceState and >>> onConfigurationChanged are not always independent. >>> My app has to manage editing data in the detail view. For example it >>> tries to ask the user whether it has to save, before going back or choosing >>> other records. >>> In many case this has to be done silently because the app is just >>> undergoing some strange eevent or transformation. >>> Furthermore the app singleton sometime is lost. >>> >>> Codename apps seem to be simpler from this point of view, but I need to >>> know if there is some "singleton" class I can count on every time, unless >>> the app is destroyed. >>> I see that there is not fragment and activity cycles so I think this is >>> easy. >>> Thanks in advance >>> >> -- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/7877f6b6-952b-4e34-beb4-281eb4b5ecc4n%40googlegroups.com.
