‫We said that the navigation graph defines the navigation flow, including start destinations, transitions,
‫and any associated arguments.
‫In this video, we'll learn how to add destinations and how to manage the navigation flow in the navigation
‫graph.
‫Go to the plus sign here.
‫Add a new destination and create a new destination.
‫You can choose your destination, your first destination.
‫I'll start with fragment and choose blank.
‫Click next and I'll name it as First Fragment.
‫Choose Java, click finish.
‫You can see that the navigation graph display the our first fragment.
‫I'll create another fragment and another destination and I'll name it as second fragment.
‫And here we go.
‫These are our destinations.
‫Each destination in the graph typically represents a screen or a UI element in your app, like a fragment
‫or an activity.
‫These destinations are identified by unique IDs, so if you go to the right, you can see the ID of
‫the second fragment is second fragment two.
‫And if you choose the first fragment, this ID will be changed to first fragment two.
‫Now I'll edit these fragments.
‫Go to the fragment first layout go split mode.
‫I'll edit this text view.
‫I'll name it as first fragment.
‫And here size would be 48 SP.
‫And I'll add a button in order to move to the second fragment.
‫But since we are working with a frame layout, we can't drag and drop.
‫We need to use the margin.
‫I'll set the background of this fragment to this color.
‫Then move to the fragment underscore.
‫Second go split mode, and again I do the same.
‫I'll create a button.
‫And I'll add the background attribute and paste this color.
‫Change the color of this text view to white and this is good.
‫So this is our first fragment and this is our second fragment.
‫Go back to navigation graph.
‫These are our fragments to link the first fragment with the second fragment.
‫It's very simple.
‫Just drag and drop this circle and match it to here.
‫So our first fragment is connected our second fragment.
‫And to go back from the second fragment to the first fragment, I'll drag and drop this circle and drag
‫it to this first fragment.
‫And you can see first fragment is connected to the second fragment.
‫And you can go from the second fragment to the first fragment.
‫If you go to the split mode, you can see we have two fragments in the nav graph.
‫We have this action and this action.
‫So again guys this is an action.
‫We are defining an action from first fragment to the second fragment and from the second fragment to
‫the first fragment.
‫So if you select this you can see this is the action named as second fragment to to first fragment to.
‫If you select this you can see its ID is action fragment or action first fragment to second fragment
‫and the destination is second fragment.