Add Navigation Components to the Project
Navigation helps the users navigate inside the application between fragments and the activity. Navigation Component, on the other hand, is part of Android Jetpack and helps us (the developers) build navigation for component clicks, deep links and more. Navigation Component consists of Navigation Graph, Nav Host and the Nav Controller. We will talk about them in detail throughout the article and implement it. 1. First, add the dependencies to the module level build.gradle file. implementation 'androidx.navigation:navigation-fragment-ktx:2.2.0' implementation 'androidx.navigation:navigation-ui-ktx:2.2.0' 2. Create a Nav Host The Nav Host is a container for all the fragments to be shown on. With the help of Nav Controller, the developer can navigate the user between fragments and nested nav graphs. <fragment android:layout_width="match_parent" android:id="@+id/nav_host_fragment" app:defaultNavHost="true" a...