Android navigation components - Fragments are destroyed when navigate to another fragment in the same nav graph

Viewed 1925

As the title says I am using Navigation Components to navigate from fragment to another inside the same navGraph, each time I navigate, the onDestroyView method is called and the whole view gets destroyed, I am sure you know that formerly.

Two questions here,

  1. am I missing something?
  2. If I have a huge complex view like a RecyclerView in one of the fragments for example, what should I do to prevent it from being destroyed(and destroying the user experience with it) and being recreated again.

Thanks

0 Answers
Related