I have a container inside MainActivity like that
<fragment
android:id="@+id/main"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="5dp"
android:paddingTop="5dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toTopOf="@+id/bottomNavigation"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/adView"
app:navGraph="@navigation/main" />
and use it like that in main activity
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.main, explorefragment);
fragmentTransaction.commit();
It shows this
Replace the tag with FragmentContainerView. how can i replace the code on main activity