Here is scenario:
Here what I try but no luck:
findNavController().navigate(
R.id.action_fragment3_to_fragment1,
null,
NavOptions.Builder()
.setPopUpTo(R.id.fragment1, true).build())
You need to close Activity 2 using finish()
and the fragments will be closed with the activity, to close Activity 2 from Fragment 3 you can use this line of code inside Fragment 3:
requireActivity().finish()