Hello fellow Stackoverflowers,
In my application there are three top destination fragments all switchable through a navigation drawer, just like in the navigation drawer template. Now there is an additional button at the home fragment with the purpose of changing to another fragment by clicking it.
I tried doing it like this:
startButton.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
NavHostFragment.findNavController(HomeFragment.this).navigate(R.id.nav_slideshow);
}
});
This works as long if you hit the on screen back button to navigate back to the home screen. but if not it breaks the navigation drawer. You will no longer be able to navigate home after clicking the button by using the navigation drawer. You will always land to the fragment you landed after clicking the fragment switch button
I have tried adding actions in the navigation.xml but it didnt work.
Does anyone have a solution for this?
Thank you in advance!