setFragmentResultListener

fun Fragment.setFragmentResultListener(requestKey: String, listener: (requestKey: String, bundle: Bundle) -> Unit)

Sets the FragmentResultListener for a given requestKey. Once this Fragment is at least in the androidx.lifecycle.Lifecycle.State.STARTED state, any results set by setFragmentResult using the same requestKey will be delivered to the FragmentResultListener.onFragmentResult callback. The callback will remain active until this Fragment reaches the androidx.lifecycle.Lifecycle.State.DESTROYED state or clearFragmentResultListener is called with the same requestKey.

Parameters

requestKey

requestKey used to store the result

listener

listener for result changes.