Coding the Fragment classes and their layouts
We will create the four classes, including the code that loads the layout as well as the actual layouts, but we won't put any of the database functionality into the Kotlin code until we have learned about Android databases in the next chapter.
Once we have our four classes and their layouts, we will see how to load them from the navigation drawer menu. By the end of the chapter, we will have a fully working navigation drawer that lets the user swap between fragments, but the fragments won't do anything until the next chapter.
Creating the empty files for the classes and layouts
Create four layout files with vertical LinearLayout
as their parent view by right-clicking on the layout
folder and selecting New | Layout resource file. Name the first file content_insert
, the second content_delete
, the third content_search
, and the fourth content_results
. All the other options can be left at their defaults.
You should now have four new layout...