I\'m using Android Navigation Component for Navigation. I have a LoginFragment which has a button to transition to SignUpFragment. On clicking the button I\'m getting this e
A weird thing happens to me, below code snippet was working on normal flow from Fragment1 to fragment2, but after coming to fragment1 and on again navigate fragment2, this was throwing the "Navigation controller not set for the view" error.
    binding.ivIcon.setOnClickListener(v -> {
            Openfragment2(v);});
private void Openfragment2(View view) {
    Navigation.findNavController(binding.ivIcon).navigate(R.id.fragment2);
}
Here problem was in view, in findNavController need to pass the onclicked view.
private void Openfragment2(View view) {
    Navigation.findNavController(view).navigate(R.id.fragment2);
}