I'm having some trouble retrieving arguments in a Fragment using BottomNavigation and NavigationUI. I retrieve null value after navigating to an addOrderFragment(picture). I'm out of ideas why this doesn't work.
Navigation layout: http://prntscr.com/pf9tl1
Activity layout: http://prntscr.com/pf9u4q
Activity layout has a NavHost fragment in which all other layouts are inflated and navigation in this segment works fine.
Main activity
UID = getIntent().getStringExtra("UID");
Bundle args = new Bundle();
args.putString("UID", UID);
//navigation
controller = Navigation.findNavController(this, R.id.fragment_container);
controller.setGraph(R.navigation.navigation_mainmenu, args);
controller.navigate(R.id.mainMenuFragment, args);
bottomNav = findViewById(R.id.bottom_navigation);
NavigationUI.setupWithNavController(bottomNav, controller);
Retrieving UID from another fragment after being navigated to it
controller = Navigation.findNavController(view);
try {
UID = getArguments().getString("UID"); <---gets null
} catch (Exception e) {
Crashlytics.logException(e);
}