Navigation Component android jetpack 2020|adding navigation component nav graph | nav host fragment

Опубликовано: 16 Октябрь 2024
на канале: Infinity. io
78
2

Among other goodies, Android Jetpack comes with the Navigation architecture component, which simplifies the implementation of navigation in Android app.
What you will learn?

Navigation graphs and nested graphs.
Actions and destinations.
How to pass data between destinations.
The NavHost interface.
Creating deep links

Why Do You Need Yet Another Component?
Navigating between screens — passing data, handling the back stack, implementing deep links, etc. — can be complicated. It also comes with quite a bit of boilerplate. To top it off, you should adhere to the new principles of navigation:

The app should have a fixed start destination.
A stack is used to represent the navigation state of an app.
The Up button never exits your app.
Up and Back are equivalent within your app’s task.
Deep linking to a destination or navigating to the same destination should yield the same stack.
By using the Navigation architecture component, you provide a consistent and predictable experience to users — hassle and boilerplate free.