0

I am using navigation component to work with lets say fragmentA, bottom sheet(dialog), fragmentB.

fragmentA has a button which opens bottom sheet, and bottom sheet also has a button which will open fragmentB. Now as I am using navigation component, I used NavHostFragment to navigate through bottom sheet to fragmentB.

NavHostFragment.findNavController(GuestBottomSheet.this)
                        .navigate(R.id.action_guestBottomSheet_to_foodSelection,bundle);

Now after clicking on button that opens fragmentB, bottom sheet is getting collapsed and I am still seeing fragmentA. I using logs to check fragmentB and I found that fragmentB is opened but its layout is not showing at my screen. I tried changing background color still its not showing.

Navigation_graph

<?xml version="1.0" encoding="utf-8"?>
<navigation 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/guest_navigation"
    app:startDestination="@id/guestWelcome">

    <fragment
        android:id="@+id/guestWelcome"
        android:name="com.androboot.procook.GuestWelcome"
        android:label="fragment_guest_welcome"
        tools:layout="@layout/fragment_guest_welcome" >
        <action
            android:id="@+id/action_guestWelcome_to_guestBottomSheet"
            app:destination="@id/guestBottomSheet" />
    </fragment>
    <dialog
        android:id="@+id/guestBottomSheet"
        android:name="com.androboot.procook.bottomSheet.GuestBottomSheet"
        tools:layout="@layout/bottom_sheet_guest">
        <action
            android:id="@+id/action_guestBottomSheet_to_foodSelection"
            app:destination="@id/foodSelection" />
    </dialog>
    <fragment
        android:id="@+id/foodSelection"
        android:name="com.androboot.procook.FoodSelection"
        android:label="fragment_food_selection"
        tools:layout="@layout/fragment_food_selection" />
</navigation>

0 Answers0