Home > Software engineering >  Where is file that contains the Navigation Graph Design data
Where is file that contains the Navigation Graph Design data

Time:11-20

So in my nav_graph.xml file, I have a lot of fragments. It took quite a while for me to drag them around in the Design view, and I want to make sure that is backed up. I'd like to track that in my git repository, but I have no idea where that information is stored.

I'm assuming it is in a file somewhere. Does anyone know where that file lives and what the name of it is?

EDIT To be clear: I am not looking for the xml file itself. I know where that is. It's over 800 lines long, so if I didn't know where that was, it would be magic that I even had a nav graph at all.

I'm looking for the file (or wherever the information is stored) that controls how it is laid out visually in the designer. That the view where you can drag the fragment tiles around to present the graph visually.

For example, this from the Android docs:

enter image description here

What if the green tile was dragged above the pink/orange tile? Something has to save those coordinates, right? Or it wouldn't load again the next time I started Android Studio. Where is that information saved??

CodePudding user response:

nav_graph itself saves all the information, related to the fragment directions and actions, which actually defines all the required information for working of the Navigation graph.

I'm looking for the file (or wherever the information is stored) that controls how it is laid out visually in the designer.

Information regarding the visual representation of the nav graph is editor specific, and Android Studio stores it in .idea > navEditor.xml.

To access .idea directory, you've to be in project mode.

Android studio

CodePudding user response:

The information is stored in nav_graph.xml itself. For designing layouts, menus and working with Nav graphs, Android Studio provides the functionality of either writing it as a code or design it, while the code will be written internally by the IDE.

enter image description here

In the above picture, you have been using Design tab to place the fragments, while on the other hand, you can check the Code tab, where it is written in plain XML

CodePudding user response:

app > res > navigation > your_nav.xml

enter image description here

  • Related