{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}
interface FragmentResultOwner
FragmentManager |
Static library support version of the framework's android.app.FragmentManager. |
A class that manages passing data between fragments.
Public methods |
|
---|---|
abstract @NonNull void |
clearFragmentResult(@NonNull String requestKey) Clears the stored result for the given requestKey. |
abstract @NonNull void |
clearFragmentResultListener(@NonNull String requestKey) Clears the stored |
abstract @NonNull void |
setFragmentResult(@NonNull String requestKey, @NonNull Bundle result) Sets the given result for the requestKey. |
abstract @NonNull void |
setFragmentResultListener( Sets the |
@NonNull
public abstract void clearFragmentResult(@NonNull String requestKey)
Clears the stored result for the given requestKey. This clears any result that was previously set via setFragmentResult
that hasn't yet been delivered to a FragmentResultListener
.
@NonNull
public abstract void clearFragmentResultListener(@NonNull String requestKey)
Clears the stored FragmentResultListener
for the given requestKey. This clears any FragmentResultListener
that was previously set via setFragmentResultListener
.
@NonNull
public abstract void setFragmentResult(@NonNull String requestKey, @NonNull Bundle result)
Sets the given result for the requestKey. This result will be delivered to a FragmentResultListener
that is called given to setFragmentResultListener
with the same requestKey. If no FragmentResultListener
with the same key is set or the Lifecycle associated with the listener is not at least STARTED, the result is stored until one becomes available, or clearFragmentResult
is called with the same requestKey.
@NonNull
public abstract void setFragmentResultListener(
@NonNull String requestKey,
@NonNull LifecycleOwner lifecycleOwner,
@NonNull FragmentResultListener listener
)
Sets the FragmentResultListener
for a given requestKey. Once the given LifecycleOwner is at least in the STARTED state, any results set by setFragmentResult
using the same requestKey will be delivered to the callback
. The callback will remain active until the LifecycleOwner reaches the DESTROYED state or clearFragmentResultListener
is called with the same requestKey.
Parameters | |
---|---|
@NonNull String requestKey |
requestKey used to identify the result |
@NonNull LifecycleOwner lifecycleOwner |
lifecycleOwner for handling the result |
@NonNull FragmentResultListener listener |
listener for result changes |