'How to get the result from a two or more fragment steps without using SharedViewModel?

Suppose I have a user registration flow within a nav_graph with the following pages:

  • User name page;
  • User birthday page;
  • User email page;
  • ...
  • User registration confirmation page;

On the User Registration Confirmation Page I have all the required fields to assemble a User object.

data class User(
    val name: String,
    val birthday: Date,
    val email: String,
    ...
)

Is there any way I can return this User result to the fragment that started the user registration flow without using a SharedViewModel?

// nav_graph_example
Frag A -> Frag B -> Frag C -> Frag User name -> ... -> Frag User registration confirmation

In the case of the previous nav_graph, return the User object from Frag User Registration Confirmation to Frag C.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source