![](/img/trans.png)
[英]popUpTo nested navigation graph ID not popping to startDestination
[英]Pass argment to a nested graph's startDestination
我在单独的文件中创建了多个图形。
第一个是GraphA ,它包括GraphB 。 startDestination
的startDestination是FragmentB ,它有一个名为AnID的参数
现在我想将AnID从GraphA 传递到GraphB ( FragmentB )
尽管编辑器知道该参数,但生成的代码不考虑该参数:
val directionB = FragmentADirections.actionFragmentAToGraphB(/* HAS NOT ARGUMENT */)
findNavController().navigate(directionB)
如何将参数传递给嵌套图?
我找到了这个,但这不是官方解决方案:
val direction = FragmentADirections.actionFragmentAToGraphB()
findNavController().navigate(direction.actionId, FragmentBArgs(anId).toBundle())
更新:
有人通过在操作中定义嵌套图参数引入了另一种方法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.