I have a DialogFragment which contains a FragmentContainerView with the following layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/fcvFiles"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
The FragmentContainerView should be replaced with a Fragment. Therefore I have a method insertNestedFragment() which is invoked in onViewCreated of the DialogFragment.
private void insertNestedFragment() {
MyFragment myFragment = MyFragment.newInstance();
getChildFragmentManager().beginTransaction().add(R.id.fcvFiles, myFragment).commit();
}
MyFragment contains a RecyclerView which is filled in the onViewCreated method.
On the basis of debug messages in MyFragment I see that the RecyclerView is filled correctly. The problem is, that the DialogFragment does not show the updated Fragment. Is there a possibillity to refresh the DialogFragment or the FragmentContainerView after the onViewCreated method of MyFragment was executed?