Linked Questions

Popular Questions

Navigation Component prevent to recreate fragment on back press

Asked by At

I'm using the Jetpack Navigation Component in my project with a signle activity and some fragments.

I have a fragment with a list that fills from server side. I call getDataFromServer on onViewCreated method, then when a user clicked on an item new fragment shows.

The problem is when I press the back button, onViewCreated calls again in my list fragment.

so how can I prevent my first fragment to recreating again? I don't want to onViewCreated calls.

Related Questions