I am moving from Fragment A to Fragment B. When I press back button, Fragment A is recreated. I wish to avoid this.
How do I do it? I am using Navigation Component e.g.
Fragment probably not recreated, but view does
But anyway, it's not related to Kotlin
👍 1
🙂 1
v
Viktor Petrovski
07/05/2020, 8:58 AM
Yeah this is the standard behavior using NavigationComponent. You should keep your data in a scoped ViewModel and observe it from view/fragment. This way even when navigating back you will present them with the data they’ve left the screen.