NavInflater

public class NavInflater
extends Object

java.lang.Object
   ↳ androidx.navigation.NavInflater


Class which translates a navigation XML file into a NavGraph

Summary

Constants

String METADATA_KEY_GRAPH

Metadata key for defining an app's default navigation graph.

Public constructors

NavInflater(Context context, NavigatorProvider navigatorProvider)

Public methods

NavGraph inflate(int graphResId)

Inflate a NavGraph from the given XML resource id.

NavGraph inflateMetadataGraph()

Inflates navigation graph as specified in the application manifest.

Inherited methods

Constants

METADATA_KEY_GRAPH

public static final String METADATA_KEY_GRAPH

Metadata key for defining an app's default navigation graph.

Applications may declare a graph resource in their manifest instead of declaring or passing this data to each host or controller:

     
 

A graph resource declared in this manner can be inflated into a controller by calling NavController.setMetadataGraph() or directly via inflateMetadataGraph(). Navigation host implementations should do this automatically if no navigation resource is otherwise supplied during host configuration.

Constant Value: "android.nav.graph"

Public constructors

NavInflater

public NavInflater (Context context, 
                NavigatorProvider navigatorProvider)

Parameters
context Context

navigatorProvider NavigatorProvider

Public methods

inflate

public NavGraph inflate (int graphResId)

Inflate a NavGraph from the given XML resource id.

Returns
NavGraph

inflateMetadataGraph

public NavGraph inflateMetadataGraph ()

Inflates navigation graph as specified in the application manifest.

Applications may declare a graph resource in their manifest instead of declaring or passing this data to each host or controller:

     
 

Returns
NavGraph

See also: