Answer the question
In order to leave comments, you need to log in
How to separate Android Activity or fragments and application state?
In our android projects, the transition between fragments or activities through intent is practiced, in which one activity calls another or one fragment initiates the launch of another fragment. As a result, each fragment must know about the next fragment and the data that it must transfer.
I want to remake this architecture so that there is only an object that stores the current state of the user, for example, what form he is on, his data, so that the object saves its state during onPause and so that fragments or activities can always be built from this object even if the application is minimized or closed. And so that fragments or activities do not know anything about other forms.
Are there examples of such an architecture?
Or frameworks that already follow this methodology?
Or how do you build such an architecture?
Answer the question
In order to leave comments, you need to log in
I use a state machine for this :
If you need to be able to access data and still be independent of life cycles, you can try the default solution from Google: Android Architecture Components . Pretty simple to use. Presentation with Russian subtitles: https://youtu.be/Dl4DiQRxBi4
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question