I am working around to preserve the view (without storing as local variable) of fragment and in current Navigation Component it looks certain that onDestroyView()
is called, I want to avoid calling onDestroyView()
with Android Navigation but there is no such method that behaves like there was in FragmentTransaction.add()
in our vanilla Fragment.
In Navigation Jetpack we have:
FragmentNavigator.navigate()
which makes use of fragmentTransaction.replace()
like this :
ft.replace(mContainerId, frag);
Why there is no option of ft.add()
method? If there is a workaround, how can we do it?
Is it like the concept of ft.add()
is being discontinued?