3

Navigation Component in Android Jetpack

 2 years ago
source link: https://www.geeksforgeeks.org/videos/navigation-component-in-android-jetpack/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Navigation Component in Android Jetpack
Navigation Component in Android Jetpack
Video Player is loading.
Loaded: 0%
Remaining Time -0:00

Nowadays, many apps follow single activity and multiple fragment architecture including the official GeeksForGeeks as well. Single activity and multiple fragments architectures have a lot of advantages over the multiple activity architecture, some of them are mentioned below: 1) Since one activity will exist in the whole architecture. So, no need to update the Manifest every time. 2) No need to declare the boilerplate method like startActivityForResult() every time as we will navigate between the fragments. 3) The transition Animation problem has also been resolved after using the fragments. So in order to achieve in architecture, we will be using the Navigation component.

Navigation refers to the interactions that allow users to navigate across, into, and back out from the different fragments within your app. The navigation component basically consists of three parts:

1) Navigation graph: An XML resource that contains all navigation-related information in one centralized location. This includes all of the individual content areas within your app, called destinations, as well as the possible paths that a user can take through your app.

2) NavHost: An empty container that displays destinations from your navigation graph. The Navigation component contains a default NavHost implementation, NavHostFragment, that displays fragment destinations.

3) NavController: An object that manages app navigation within a NavHost. The NavController orchestrates the swapping of destination content in the NavHost as users move throughout your app. In this video will create a very simple application that has single activity and 3 fragments that are login fragment, signup fragment, and forget password fragment using the navigation component.

Jetpack Navigation Component in Android: https://www.geeksforgeeks.org/jetpack-navigation-component-in-android/


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK