I am trying to understand the code structure of default Navigation drawer created in android studio 3.6.3. In Navigation drawer when menu item is clicked it shows it corresponding fragment layout. I am trying to understand the mechanism. I have found that the navigation graph fragments id name and menu item id name are both same. I have first changed the menu item id name and called inside main activity using (R.id.menu_id). And when I launch the application the navigation menu were not functioning. Then I renamed the menu id name to as it was and changed the fragment's id name. But unfortunately after launching the app the menus didn't functioned. When I kept the both name same the menu works.
Inside (resource/navigation/mobile_navigation.xml).
Inside (resource/menu/activity_main_drawer.xml)

Inside (java/MainActivity.java)

Need someone guide on am I understanding wrong or not.