Hi friends, Encountered a weird issue when using V...
# android
n
Hi friends, Encountered a weird issue when using ViewBinding with Fragments. fragment_one_layout
Copy code
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <include
        android:id="@+id/name"
        layout="@layout/form_element_layout" />

    <include
        android:id="@+id/unit"
        layout="@layout/form_element_layout" />
    <include
        android:id="@+id/quantity"
        layout="@layout/form_element_layout" />
</LinearLayout>
form_element_layout
Copy code
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <TextView
        android:id="@+id/title"
        style="@style/TextViewRegularHeading"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/title"
        android:textSize="@dimen/title_text_size" />

    <EditText
        android:id="@+id/input"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/edit_text_forms_bg"
        android:hint="@string/form_hint"
        android:inputType="text" />
</LinearLayout>
After entering values in
name.input
,
unit.input
and
quantity.input
fields, I've navigated to fragment_two. When returning from the fragment_two to fragment_one, the values in every field changed to the value of the
quantity.input
Eg : name is John, unit is Kg and quantity is 80. After navigating to fragment_two and returned, the name, unit and quantity values are changed to 80, Any help?
😶 5
j
K android new Using Kotlin to build Android apps. Avoid 😶. 😶 questions should go here: stackoverflow; http://android-united.community/ https://androidchat.co/ or https://discord.com/invite/D2cNrqX
n
Sorry, kinda new to Slack
j
Nah that’s cool, it’s easily done 😄