34,333
edits
Changes
→Declaring a Navigation Host
Before adding any destinations to the navigation graph, the next step is to add a navigation host fragment to the project.
== Declaring Declaring a Navigation Host ==
For this project, the navigation host fragment will be contained within the user interface layout of the main activity. This means that the destination fragments within the navigation graph will appear in the content area of the main activity currently occupied by the main_fragment.xml layout. Locate the main activity layout file in the Project tool window (app -> res -> layout -> main_activity.xml) and load it into the layout editor tool.
super.onCreate(savedInstanceState);
setContentView(R.layout.main_activity);
}
</pre>
[[File:as_3.2_navigation_navhost_added.png]]
== Adding Navigation Destinations ==