//workflow/com.squareup.workflow1.ui.androidx/WorkflowSavedStateRegistryAggregator/installChildRegistryOwnerOn
installChildRegistryOwnerOn¶
[androidJvm]
Content
fun installChildRegistryOwnerOn(view: View, key: String)
More info
Puts a new ViewTreeSavedStateRegistryOwner in place on view, registered with its ViewTreeLifecycleOwner. (Use WorkflowLifecycleOwner to ensure one is properly installed.)
This method must be called before view is attached to a window.
Clean up requirements after making this call are nuanced. There is no need to remove the SavedStateRegistryOwner from the view itself, but this WorkflowSavedStateRegistryAggregator must be informed when view is retired from use:
- if [view](install-child-registry-owner-on.md) is dropped but may later be replaced with a new instance, as when pushing and popping a back stack, call [saveAndPruneChildRegistryOwner](save-and-prune-child-registry-owner.md). This will capture the outgoing view's state, and to stop requesting updates from it. The saved state will be restored to the next [view](install-child-registry-owner-on.md) passed to [installChildRegistryOwnerOn](install-child-registry-owner-on.md) with the same [key](install-child-registry-owner-on.md)
- if [view](install-child-registry-owner-on.md) is dropped and will not be restored, as when a window is closed or back stack history is modified, call prune*with the keys of the views that remain active*.
Parameters¶
androidJvm
key | identifier for the new ViewTreeSavedStateRegistryOwner, unique across this WorkflowSavedStateRegistryAggregator. Typically this is derived from the compatibility key of the view‘s rendering. |