E
E
Ernesto Guevara2014-12-10 09:36:31
Android
Ernesto Guevara, 2014-12-10 09:36:31

How to store a single model (business logic) for multiple Activities in Android?

I am writing the first application more complex "Hello World" for Android. The question arose: Is it good to store a single model for several Activities in one Singleton? I also want to make a layer of work with SQLite as a Singleton (maybe later I will replace it with a ContentProvider).
In a simplified form, the following application structure is obtained:
SQLite <-> DataAccessLayer <-> Model (business logic) <-> Activities
Then, for example:
1. Activity changes something in the model.
2. The model is recalculated, throws something into the database through the DataAccessLayer.
3. When the user opens another Activity, it pulls the updated data from the model and displays it.
Maybe in Android there is some other well-established pattern?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question