Is this the most elegant way to “go back two scree...
# android
s
Is this the most elegant way to “go back two screens (i.e. two fragments)” if I have a single activity app using the navigation architecture component? Seems extremely strange, but works perfectly (calling this method twice…).
Copy code
fragmentManager?.popBackStack()
fragmentManager?.popBackStack()
(edited)
a
what's the use case for, "go back two screens?" It sounds like you're trying to do something specific but two backs is incidentally correct in that specific circumstance
generally you would navigate to another particular destination, or pop to a certain tag marker
s
use case: Screen A is a form, Screen B is a subset of options for the one of the fields, and Screen C is a set of options for one of the options in Screen B. Choosing an option on Screen C should “go back” to screen A, skipping Screen B.
to pop to the specific destination of screen A
s
This is exactly what I needed. Thanks 😃
👍 6