Frequently asked question
- The missing link is that if all these fragments are fully functioning independent controllers, then we need to learn a bit more about how we would implement our model layer. If we simply have, say, an
ArrayList
, like with the Note to Self app, where will theArrayList
instance go? How would we share it between fragments (assuming both/all fragments need access to the same data)?There is an entirely more elegant solution we can use to create a model layer (both the data itself and the code to maintain the data). We will see this when we explore the
NavigationView
layout in Chapter 26, Advanced UI with Navigation Drawer and Fragment, and Android databases in Chapter 27, Android Databases.