Issue
I use Android Navigation Architecture Component.
I have three Fragment A, B and C
- Fragment A -> Fragment B -> Fragment D
- Fragment A -> Fragment C -> Fragment D
On fragment D I have a button used to validate modifications and finish. From this Frgament D I would like to:
- return to Fragment B when I come from Fragment B (I use
findNavController().navigateUp()) - come back to Fragment A when I come from Fragment C (I don't know how to do it)
How can I go back directly to Fragment A when I come from Fragment D without going back to Fragment C?
Should I wait for the return on Fragment C and reprocess for the execution of findNavController().NavigateUp().
Solution
I use setPopUpTo on NavOptions, or you can use it inside the xml as well
documentation => https://developer.android.com/reference/androidx/navigation/NavOptions.Builder#setPopUpTo(int,%20boolean)
Answered By - Saba
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.