Presenting data in Android applications
In this section, we will look at various architecture patterns suitable for presenting data in an Android application and analyze their benefits and drawbacks.
Early Android applications relied on a pattern similar to the Model-View-Controller (MVC) architecture pattern, where an activity is the Controller, the View is represented by the android.widget.View
hierarchy, and the Model is responsible for managing the application's data. The relationship between the components would look something like the following:
From Figure 8.1, we can see that the Controller represented by the activity would interact with the Model to fetch and manipulate the data, and then it would update the View with the relevant information.
The idea is to have each Activity
sandboxed as much as possible so that they can be offered and shared between multiple applications (like how the Camera...