I use Navigation and I have a lot of subgraph (nes...
# android
p
I use Navigation and I have a lot of subgraph (nested graph). How to navigate to specific Fragment in nested graph (other startDestination).
đŸ˜¶ 5
p
Thank for your support. So if I use deeplink, can I pass bundle to destination?
i
No, only the URI, as per the comments on that exact answer
p
What a pity! Maybe I need another solution
i
Also as per the comments, you shouldn't be passing anything but an identifier between destinations, which fit perfectly with URIs 🙃
👍 1
p
But in my case, Fragment need arguments
i
And the URI is parsed for arguments, which are automatically provided to the fragment, just like every implicit deep link: https://developer.android.com/guide/navigation/navigation-deep-link#implicit
👍 1
m
It’s a shame this doesn’t work for Parcelable arguments. It would be nice if we could provide some mapper to facilitate conversion of uri to parcelable. Alternatively, the ability to specify multiple arg groups (analogous to multiple constructors), so the deepLink could use a non-parcelable one.
i
As also mentioned in the comments on that answer, you really shouldn't use Parcelables at all as arguments, particularly with the extremely limited transaction limit
👍 1
m
In my case, the fragment argument is a sealed class, where different concrete subclasses have different arguments. The only common method is
toUri()
so I guess I’m forced to use Uri as the arg. So this means I cannot use the deepLink pattern matching unfortunately. This could be solved by allowing different “bundles” of arguments where each “bundle” is analogous to a different concrete subclass and would have its own set of deepLinks.