Frequently asked question
Q) 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 an ArrayList
, like with Note to Self, where will it go? How would we share it between fragments (assuming both/all fragments need access to the same data)?
A) There is an entirely more elegant solution we can use to create a model layer (both data itself and the code to maintain the data). We will see this when we explore NavigationView
in Chapter 26, Advanced UI with Navigation Drawer and Fragment, and Android databases in Chapter 27, Android Databases.