I'm developing an app which is made of SingleActivity&Fragments.
The project flow is below.
Project flow
Navigation flow
RegisterPhotoFragment
has a photo button. If i click the button, it show the CameraOrGalleryBottomSheetDialog
by using navigate(actionid)
.
In the CameraOrGalleryBottomSheetDialog
, I can take a photo or get a image url from gallery.
For the process, I'm using setFragmentResultListener
in RegisterPhotoFragment
and setFragmentResult
in CameraOrGalleryBottomSheetDialog
.
But the problem is, I can't get the image uri from CameraOrGalleryBottomSheetDialog
in RegisterPhotoFragment
and I realized that RegisterPhotoFragment
is just made by using ViewPager2 in BeginningFragment
not navigate(anctionid)
. So, i didn't use navigate(actionid)
to go to the RegisterPhotoFragment
.
Therefore, I changed the navigation flow like below.
Second Navigation Flow
I restarted my app and it happened a crash.
java.lang.IllegalArgumentException: Navigation action/destination mypackage:id/action_registerPhotoFragment_to_cameraOrGalleryBottomSheetDialog cannot be found from the current destination Destination(mypackage:id/beginningFragment) label=BeginningFragment class=,mypackage.presentation.ui.beginning.BeginningFragment
because i added the RegisterPhotoFragment res/navigation/navGraph
but i didn't use navigate(actionid)
. If i use naviagte(actionid)
, I can only see the screen of RegisterPhotoFragment
. So, i didn't use it.
Finally, I decided to make a RegisterPhotoNavHostFragment
and it has only FragmentContainerView
and the Navigation Flow is changed again like below.
Sadly, I thought it works but it didn't. the same crash occured.
How can i make it? is this idea wrong?