Sample app leveraging Android Navigation Component
This is a sample project where I experimented with different aspects of the Android Navigation Component.
startActivityForResult
and onActivityResult
)There's no MVP/MVVM/MVI here - just the Navigation Component to make the sample simple.
Normally deep links would clear the entire back stack and start fresh. There are some differences between explicit and implicit deep links as well whether Intent.FLAG_ACTIVITY_NEW_TASK was provided or not.
In the sample app, regardless of Intent.FLAG_ACTIVITY_NEW_TASK
I wanted to show the Fragment on top of the existing stack if the app was in the background or and start a new stack only if it was killed.
Also, this deep link when opened would pop specific Fragments from the back stack.
My approach is based on Using Navigation Architecture Component in a large banking app article with some tweaks added to be able to pop the back stack further than the previous screen e.g. 2 screens back.
In the sample app this happens when e.g. we have the following stack:
Offer Fragment --> Collective login Fragment -> Login with password Fragment
Now, what we would like to do is go back to Offer Fragment and in there handle this result and e.g. start Apply Fragment.