2

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?

akhilsreekar
  • 196
  • 8
  • 2
    Dialogs have *no* effect on other fragments. What are you trying to do with that information? – ianhanniballake Jan 22 '21 at 16:15
  • Sorry for the late reply.I am making an app in which I scan a qr code and show a bottom sheet diaglog fragment.Upon showing the fragment, the qr code scanner needs to stop scanning.But right now, as it is not pausing the scan, many bottomsheets are popping one upon the another. In general, I would have used onPause/onStop to pause the scanning.How to do it right now? – akhilsreekar Feb 12 '21 at 16:49

0 Answers0