Skip to content

Q: How to return a result to a previous component? #201

Answered by arkivanov
falcon4ever asked this question in Q&A
Discussion options

You must be logged in to vote

The StateKeeper is indeed closest to SavedStateHandle. You are receiving null in A1 component because you never set any value with the key A2_RESULT. Moreover, it is not possible (yet) to just set a value to StateKeeper. You can only register value suppliers, and it is saved when the system calls StateKeeperDispatcher.save(). Also please note, that StateKeepers are local to its component, so you can't access values saved in another components. This is same as with SavedStateHandle. This approach allows you to use same keys in sibling components without clashing. So I think you are doing not as written in the linked Google's documentation page.

Regarding the way of handling results recomme…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by falcon4ever
Comment options

You must be logged in to vote
2 replies
@arkivanov
Comment options

@arkivanov
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants