Navigating multiple pages with state parameters
App navigation is an important topic because it's the core of a user's experience. You want to manage the user's expectation on what would happen after they submit a form or after they go to a new tab. In addition, you may want to ensure that the user data is available on the correct page or in the correct state. This could also get more complicated when the requirement of a back navigation is involved.
This section will teach you how to work with NavController
and NavParams
, which are the two important base classes to manage all navigation for the app. This is a screenshot of the app you will develop:
This app has three different examples of how to navigate to a different page and how to pass the parameters. When you click on any button, it will show the second page, which is as follows:
The second page, basically, captures the parameters and displays them on the screen. It also gives you three different options to navigate back...