akhilsreekar
akhilsreekar

Reputation: 326

Cannot call onResume/onPause when using navigation with dialog(BottomSheetDialogFragment)

Sorry if the naming is bad, but, there are too many things, so had to change the names. But I am having an issue with navigation. I have a nav_graph as following.

<fragment
        android:id="@+id/SomeFragment"
        android:name="com.akhilsreekar.fragments.SomeFragment"
        android:label="fragment_some"
        tools:layout="@layout/fragment_some">
        <action
            android:id="@+id/action_SomeFragment_to_OtherFragment"
            app:destination="@id/workerDetailFragment"
            app:popUpTo="@+id/QRScanFragment"/>
<!...some other arguments and actions...>
</fragment>
<dialog
        android:id="@+id/OtherFragment"
        android:name="com.akhilsreekar.fragments.OtherFragment"
        android:label="OtherFragment">
<!...some arguments and actions...>
</dialog>

I am navigating using this to show the dialog in my fragment

            findNavController().navigate(
                QRScanFragmentDirections.actionSomeFragmentToOtherFragment(
                    *reqArgs*
                )

Where class OtherFragment: BottomSheetDialogFragment{...}. OtherFragment is being opened. But the problem is when I navigate to OtherFragment,the onPause function of SomeFragment is not being called. and vice versa( that is when I dismiss the otherfragment, the onResume is not being called in someFragment). What is the reason? Am I missing something?

Upvotes: 2

Views: 1162

Answers (0)

Related Questions