Summary
This chapter has covered fragments in depth, starting with learning the fragment lifecycle and the key functions to override in your own fragments. We then moved on to adding simple fragments statically to an app in XML and demonstrating how UI display and logic can be self-contained in individual fragments. Other options for how to add fragments to an app using a ViewGroup
and dynamically adding and replacing fragments were then covered. We then finished with how this can be simplified by using the Jetpack Navigation component.
Fragments are one of the fundamental building blocks of Android development. The concepts you have learned here will allow you to build upon and progress to creating increasingly more advanced apps. Fragments are at the core of building effective navigation into your app in order to bind features and functionality that is simple and easy to use. The next chapter will explore this area in detail by using established UI patterns to build clear and...