Android. Navigation component, how to open fragment on top of previous?

Viewed 18

I'm using navigation component and here my code to navigate from one fragment to another:

 NavHostFragment.findNavController(fragment).navigate(navId)

The problem that navigate() just replace fragment, but I need to add my fragment to top of previous.

I know there is dialog destinations but I don't need fragment to inherit from DialogFragment, it does not suit me.

Is it possible using the navigation component to open a fragment like using a transaction add() ? Please, help me.

0 Answers
Related