Jetpack Navigation
Using dynamic and static fragments, although very flexible, introduces a lot of boilerplate code into your app and can become quite complicated when user journeys require adding, removing, and replacing multiple fragments while managing the back stack.
Google introduced Jetpack components, as you learned in Chapter 1, Creating Your First App, to use established best practices in your code. The Navigation
component within the suite of Jetpack components enables you to reduce boilerplate code and simplify navigation within your app. We are going to use it now to update the Star Sign app.
Exercise 3.05 – adding a Jetpack navigation graph
In this exercise, we are going to reuse most of the classes and resources from the last exercise. We will first create an empty project and copy the resources. Next, we will add the dependencies and create a navigation graph.
Using a step-by-step approach, we will configure the navigation graph and add destinations...