I am creating an app with 4 fragments (Home, Webshop, Cart, Profile). I have one activity (MainActivity) and a NavigationBar. When I'm on the Home page, I don't use the NavigationBar so it's hidden, I use the icons on the page instead for navigation (with Navigation Graph actions) and for this I use the icons' onClickListeners. So if I click on for example the Webshop, it nicely takes me to the Webshop fragment, from here I can navigate to the Cart and the Profile fragments. But not to the Home one... Whenever I click on the Home icon on the NavigationBar, it takes me to the Webshop (the fragment I chose the first time I navigated from the Home page). Same thing happens if I choose any other fragments the first time: if I choose the Cart first, then form then on whenever I click on the Home icon, it takes me to the Cart, and so on. I have no idea what could be the problem. It seems like its permanently setting that if I navigate to the Home page, the setOnClickListener - that I used for the first time - is firing.
Here I first choose the Webshop, then it always takes me to the Webshop:
Here I first choose the Cart, then it always takes me to the Cart:
Here I first choose the Profile, then it always takes me to the Profile:
I have a feeling I can't use NavigationGraph and NavigationBar together, I tried to merge them together somehow but could not figure it out.
Here's some code: