I found the question but does not have solution in code
I want to have data when backpress/manual back happens. I am using navigateUp() to go back. How
To pop destinations when navigating from one destination to another, add an app:popUpTo attribute to the associated element.
To navigate from fargment2 to Fragment1 with arguments, specify in the navigation graph the action of the caller fragment and the arguments of the destination fragment :
In your Fragment2 class, you call your action and pass your argument:
val action = Fragment2Directions.action2To1("MY_STRING_ARGUMENT")
findNavController().navigate(action)