https://kotlinlang.org logo
#android
Title
# android
h

haris mehmood

06/23/2021, 10:15 AM
hI, I'm using navigation component but on back press its recreating the fragment any solution for this ? Thanks
😶 4
s

Sam

06/23/2021, 12:43 PM
Probably not the best forum to ask since this Slack is meant for Kotlin specific discussion. But I believe your issue is because navigation component only uses "replace" fragment transactions rather than "add" ones. So fragments will always be recreated. You can usually get around this by ensuring you can always recreate the state from your application business logic