I tried use Android Navigation component and have a problem with back stack.
I have Fragment A, B. I write:
Navigation.findNavController(view).navigate(R.id.a_to_b)
It's ok. But if I want return to A, i call:
Navigation.findNavController(view).popBackStack();
Then in fragment B will be calling onViewStateRestored with null state why?
I want to keep state when calling navigate to Fragment A.
try this
val controller = Navigation.findNavController(view)
controller.popBackStack(R.id.id_of_fragment_which_you_want_to_skip, true)