In a fragment I setFragmentResultListener
and wait for the results:
setFragmentResultListener(EnableFingerPrintFragment.ARG_REQUEST_KEY) { _, bundle ->
bundle.getString(EnableFingerPrintFragment.ARG_RESULT_KEY)
?.let { isActivatedResult: String ->
// DO something
}
}
findNavController().navigate(R.id.to_enableFingerPrintFragment,)
When the result comes back this fragment gets Recreated and onCreateView
is called.
How to know if the onCreateView
is called for the first time fragment created OR it is from result coming back (after result is set in destination fragment)?
How to know if result is set onViewCreated
to check this condition?