Navigation Component Passing Data with Safe Args in Android Studio - Part II

preview_player
Показать описание
This is the second part of the complete mini course on navigation component. In this tutorial, you will learn how to send data from one fragment to another fragment using Safe Args in navigation component in your application. Safe Args is strongly recommended for navigating and passing data between fragments because it prevents data type mismatch errors and app crashes.

Add Dependency
******************
dependencies {
def nav_version = "2.3.0-alpha04"

}

Compile Options
******************
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
}

Kotlin Plugin
**************

The navigation component consists of three keywords that are described as bellow:
1- Navigation Graph: is a resource file that contains all of your destinations and actions. The graph represents all of your app's navigation paths.
2- NavHost: is 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: its an object that manages app navigation within a NavHost. This would help to replace one fragment with another fragment in the NavHost container.

🔴 Subscribe for more educational tutorials on CodeWithMazn channel!

Follow me on Instagram
Рекомендации по теме
Комментарии
Автор

Life saver, thank you so so so so much my friend

JW-opdr
Автор

What does the message "cannot be found from the current destination Destination" mean?

CindyExPlayer
Автор

Can i send from activity to fragment.?

abdelrhmanosama
welcome to shbcf.ru