Recreating backstack with Android Navigation Architecture Component

前端 未结 1 1134
花落未央
花落未央 2021-02-14 08:44

I am trying to implement navigation to specific Detail pages of my app using PendingIntent from a notification, however I am having problems recreating the backstack from the De

1条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-14 09:20

    Thanks to M.G for pointing to the right direction, I have managed to solve this by manually creating the backstack using the navigation library. This means sequentially calling findNavController(...).navigate(...) multiple times to create a backstack.

    For example when I deep link to fragment 3 but want an up navigation back to fragments 1 and 2, I call:

    findNavController.navigate(R.id.fragment1, ...)
    findNavController.navigate(R.id.fragment2, ...)
    findNavController.navigate(R.id.fragment3, ...)
    

    0 讨论(0)
提交回复
热议问题