FAQ
- As each Fragment is an entirely separate class, how will they communicate with each other?
We will solve this problem with a practical use of Java that you have already learned about—interfaces—along with some other tools as well, starting in the next chapter.
- The other missing link is that, if all these fragments are fully functioning independent controllers, then you need to learn a bit more about how we would implement our model layer. If we simply have
ArrayList
, like with Note To Self, where will it go? How would we share it between fragments (assuming both fragments need access to the same data)?There is an entirely more elegant solution that we can use to create a model layer (both the data itself and the code to maintain the data). We can use the Java singleton, and we will do so in the next chapter.