Android Navigation Fragment make fragment launch mode to singleTop?

I have an activity with FragmentContainerView and I use a navigation map for launching fragments. which have 4 fragments namely:

  • HomeFragment
  • Fragment A
  • Fragment B
  • Fragment C.

User can navigate to any fragment from any other fragment.

I wanted the following behavior:

If user navigate from Home -> A -> B -> C -> B

And if he click on back, I want the back-stack should be B -> A -> Home.

I want behavior like singleTop or singleTask

Source: Android Questions

LEAVE A COMMENT