Google se compromete a impulsar la igualdad racial para las comunidades afrodescendientes. Obtén información al respecto.

FragmentResultOwner

public interface FragmentResultOwner

androidx.fragment.app.FragmentResultOwner


A class that manages passing data between fragments.

Summary

Public methods

abstract void clearFragmentResult(String requestKey)

Clears the stored result for the given requestKey.

abstract void clearFragmentResultListener(String requestKey)

Clears the stored FragmentResultListener for the given requestKey.

abstract void setFragmentResult(String requestKey, Bundle result)

Sets the given result for the requestKey.

abstract void setFragmentResultListener(String requestKey, LifecycleOwner lifecycleOwner, FragmentResultListener listener)

Sets the FragmentResultListener for a given requestKey.

Public methods

clearFragmentResult

public abstract void clearFragmentResult (String requestKey)

Clears the stored result for the given requestKey. This clears any result that was previously set via setFragmentResult(String, Bundle) that hasn't yet been delivered to a FragmentResultListener.

Parameters
requestKey String: key used to identify the result

clearFragmentResultListener

public abstract void clearFragmentResultListener (String requestKey)

Clears the stored FragmentResultListener for the given requestKey. This clears any FragmentResultListener that was previously set via setFragmentResultListener(String, LifecycleOwner, FragmentResultListener).

Parameters
requestKey String: key used to identify the result

setFragmentResult

public abstract void setFragmentResult (String requestKey, 
                Bundle result)

Sets the given result for the requestKey. This result will be delivered to a FragmentResultListener that is called given to setFragmentResultListener(String, LifecycleOwner, FragmentResultListener) with the same requestKey. If no FragmentResultListener with the same key is set or the Lifecycle associated with the listener is not at least Lifecycle.State.STARTED, the result is stored until one becomes available, or clearFragmentResult(String) is called with the same requestKey.

Parameters
requestKey String: key used to identify the result

result Bundle: the result to be passed to another fragment

setFragmentResultListener

public abstract void setFragmentResultListener (String requestKey, 
                LifecycleOwner lifecycleOwner, 
                FragmentResultListener listener)

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

Parameters
requestKey String: requestKey used to identify the result

lifecycleOwner LifecycleOwner: lifecycleOwner for handling the result

listener FragmentResultListener: listener for result changes