{% setvar book_path %}/reference/kotlin/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 functions |
|
---|---|
Unit |
clearFragmentResult(requestKey: String) Clears the stored result for the given requestKey. |
Unit |
clearFragmentResultListener(requestKey: String) Clears the stored |
Unit |
setFragmentResult(requestKey: String, result: Bundle) Sets the given result for the requestKey. |
Unit |
setFragmentResultListener( Sets the |
fun clearFragmentResult(requestKey: String): Unit
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
.
Parameters | |
---|---|
requestKey: String |
key used to identify the result |
fun clearFragmentResultListener(requestKey: String): Unit
Clears the stored FragmentResultListener
for the given requestKey. This clears any FragmentResultListener
that was previously set via setFragmentResultListener
.
Parameters | |
---|---|
requestKey: String |
key used to identify the result |
fun setFragmentResult(requestKey: String, result: Bundle): Unit
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.
Parameters | |
---|---|
requestKey: String |
key used to identify the result |
result: Bundle |
the result to be passed to another fragment |
fun setFragmentResultListener(
requestKey: String,
lifecycleOwner: LifecycleOwner,
listener: FragmentResultListener
): Unit
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 | |
---|---|
requestKey: String |
requestKey used to identify the result |
lifecycleOwner: LifecycleOwner |
lifecycleOwner for handling the result |
listener: FragmentResultListener |
listener for result changes |