Google is committed to advancing racial equity for Black communities. See how.

Create destinations

You can create a destination from an existing fragment or activity. You can also use the Navigation Editor to create a new destination or create a placeholder to later replace with a fragment or activity.

Create a destination from an existing fragment or activity

In the Navigation Editor, if you have an existing destination type that you'd like to add to your navigation graph, click New Destination , and then click on the corresponding destination in the dropdown that appears. You can now see a preview of the destination in the Design view along with the corresponding XML in the Text view of your navigation graph.

Create a new fragment destination

To add a new destination type using the Navigation Editor, do the following:

  1. In the Navigation Editor, click the New Destination icon , and then click Create new destination.
  2. In the New Android Component dialog that appears, create your fragment. For more information on fragments, see the fragment documentation.

Back in the Navigation Editor, notice that Android Studio has added this destination to the graph.

Figure 1 shows an example of a destination and a placeholder destination.

Figure 1. A destination and a placeholder

Create a destination from a DialogFragment

If you have an existing DialogFragment, you can use the <dialog> element to add the dialog to your navigation graph, as shown in the following example:

<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android=""


    <argument android:name="myarg" android:defaultValue="@null" />



Placeholder destinations

You can use placeholders to represent unimplemented destinations. A placeholder serves as a visual representation of a destination. Within the Navigation Editor, you can use placeholders just as you would any other destination.