TLDR: What is the difference between finishAffinity() and finishAndRemoveTask()?
I am working on an Android app that has one single activity, and uses fragment switching instead of new activities.
I was having a weird issue with a certain fragment living through the backstack even when clearing the backstack. Long story short, this fragment was living because I started a web browser from that fragment.
Using the popular press back x2 to exit the app technique in my main acitvity, it would 'exit' using finishAndRemove task. This would return to that certain fragment, rather than exiting entirely. Changing the back x2 exit flow from finishAndRemoveTask to finishAffinity solved my problem. Why did this work?