I'm trying out Android's new Navigation Editor for the first time and I'm not sure if this is a missing feature, intentional omission, or if I'm missing something. I have two fragments and I want the first fragment to be able to navigate to the second one, but I want the activity to finish if back is pressed from either fragment.

With my current setup, I can navigate from mainFragment to newFragment. If I press back from the mainFragment, the activity finishes. The only piece I can't figure out is how to finish the activity when back is pressed from newFragment. I've tried every combination of Pop Behavior settings, but haven't achieved what I'm looking for.
See the screenshot and look for Pop Behavior. This option can be used to finish activity.
Please note: Finish activity = pop the Activity off the stack.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With