title: android app stop variable from resetting - lifecycle
body: <p>I have an app that has a few screens.
  The Main screen automatically opens a "new" screen if it's the first time the user opens the app.
  I then set a boolean variable (on the Main screen) keeping track of this.</p>
  
  <p>The intention is if the user goes back to the Main screen, the code that opens the "new" screen can be skipped.</p>
  
  <p>The problem is that the variable keeps getting reset on OnCreate.
  So, I added some code to use SharedPreferences.</p>
  
  <p>This works; however, I want to clear the variable when the app exits.
  (I want the "new" screen to open every time the app opens the first time).
  So, looking at the lifecycle I tried both onStop and onDestory.
  The SharedPreferences are cleared but... not when the app is exited; but when the "new" screen appears.</p>
  
  <p>Am I looking at the lifecycle wrong?
  Is there some sort of global variable I can declare that only lives while the app is open?</p>
  
  <p>This functionality is the requirement, so I cannot change it.</p>