'Problem with reloading Fragments in Navigation component
I have navigation with multiple backstack. Everything is done as in
https://link.medium.com/z34TYZxorpb
except that the fragments go in a circle

the problem is that when I go through this and go back to the previous fragment, the fragment does not save data and the view is reloaded
Edit:
I noticed one thing that when I use the coordinator layout in xml, then at this moment it is not saved after returning to the backstack
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/title_constraint"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout_editor_absoluteY="81dp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/text_view"
android:gravity="center_horizontal"
android:layout_width="368dp"
android:layout_height="81dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:text="Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Aenean commodo ligula eget dolor. Aenean
massa. Cum sociis natoque penatibus et magnis dis parturient
montes, nascetur ridiculus mus. Donec quam felis, ultricies
nec, pellentesque eu, pretium quis, sem. Nulla consequat
quis enim. Donec pede justo, fringilla vel, aliquet nec, vulp
utate eget, arcu. In enim justo, rhoncus ut, imperdiet a, vene
natis vitae, justo. Nullam dictum felis eu pede mollis pretium
. Integer tincidunt. Cras dapibus. Vivamus elementum semper nis
i. Aenean vulputate eleifend tellus. Aenean leo ligula, porttito
r eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, d
apibus in, viverra quis, feugiat a, tellus. Phasellus viverra n
ulla ut metus varius laoreet. Quisque rutrum. Aenean imperdie "
android:textAlignment="center"
android:textAllCaps="false"
android:textColor="@color/colorAccent"
android:textSize="48sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.32999998" />
</ScrollView </androidx.coordinatorlayout.widget.CoordinatorLayout>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
