title: Activity.finish unless there is nothing behind
body: <p>in whatsapp when you are in a chat and go back it closes the chat leaving you at the home screen scrolled to where you were.  However if you got to the chat through a notification and there is no home screen then it creates a new one.  How do they do this?</p>
  
  <p>I was thinking some sort of ifHasBackStack, but was wondering if there is a cleaner way and if not what is the best way to find the backstack size</p>
  
  <p>It appears in trying to be more clear in my question i made it slightly different to the actual use case, however this was a mistake as the answer changes now.  </p>
  
  <p>The actual use case is i want apps to be able to share items to my app from their gallery (or other image apps).  If the user gets an image from inside the app, i can use activity.finish() on the final part of the posting an image section and it works great, however if i use activity.finish() if they get to my app from another app eg gallery, then i want to take them to my home screen.  </p>
  
  <p>Sorry for the confusion caused!</p>