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:
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??
3
Answers
The information is stored in
nav_graph.xml
itself. For designing layouts, menus and working withNav
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.In the above picture, you have been using
Design
tab to place the fragments, while on the other hand, you can check theCode
tab, where it is written in plainXML
nav_graph
itself saves all the information, related to the fragment directions and actions, which actually defines all the required information for working of theNavigation graph
.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.