The two screens relevant to my issue amount to MainFragment
(a master view) and ProfileFragment
(a detail view). The launch path from login -> main -> profile works fine. The return path isn't working as well. I get stranded at main when navigating backward with via gesture or device button.
On the initial "back" from the profile, I'm returned to main and see main's onViewCreated
, onResume
lifecycles. I expect back from main would return to login or even exit the app, but instead it reloads main a dozen times before crashing.
For any subsequent "back" from main, the logs reveal main's onAttach
, onCreate
, onViewCreated
, onResume
lifecycles recurring each time. This seems suspicious although it's a pretty vanilla navigation graph, a single Activity hosting four basic Fragments. They're all navigated with basic actions using their generated, type-safe Directions
classes. I haven't overridden onBackPressed
in any of these classes.
Combinations of app:popUpTo="@+id/loginFragment"
and/or app:popUpToInclusive="true"
haven't helped.
Do I need to implement back or "up" in order to work as expected? Any thoughts are appreciated.