Örnek-2: Destination'lar Arasında Veri Aktarma
Bir önceki örneğimizde iki destination arasında geçiş yapmayı öğrendik. Peki bu geçiş sırasında bir veri aktarmak istersek ne yapacağız? Bu dersimizde bunu öğreneceğiz.
Tip Güvenliği Olmayan Yöntem
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".BlankFragment">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/tvMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/hello_blank_fragment"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
<EditText
android:id="@+id/etName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Adınızı Giriniz"
android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="@id/tvMessage"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:importantForAutofill="no"
android:inputType="text" />
<Button
android:id="@+id/btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="@id/etName"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:text="Nested Graph'a Git" />
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>

Safe Args kullanarak veri aktarımı



PreviousÖrnek-1: NavController Kullanarak Bir Hedef Noktasına GitmekNextÖrnek-3: Navigation Komponenti ile Options Menu Kullanımı
Last updated