Navigation Component: pass safeArgs from activity to a fragment

前端 未结 2 1697
感动是毒
感动是毒 2021-01-04 12:52

I have two graphs, so the first graph move from one fragment to an activity passing safeArgs to the activity.

val action = MyFragmentDirections.actionMyActiv         


        
2条回答
  •  执笔经年
    2021-01-04 13:04

    I don't know if this is recommended, but it is working:

    val args = MyActivity.fromBundle(intent.extras)
    navController.navigate(R.id.myActivityFragment, args.toBundle())
    

提交回复
热议问题