title: how to handle login and logout in an android app
body: <pre><code>Android Studio 3.4.0
  </code></pre>
  
  <p>I have app that when starts up will show an <code>login activity</code>. The user will login by sending username and password and will receive a JWT for authorization.</p>
  
  <p>I have stored this authorization token in shared preferences. When they logout I will remove the authorization token from shared preferences.</p>
  
  <p>However, when the user starts the app, I want to be able to check if the authorization token is stored and if its not show them the <code>login activity</code> or if it does exist allow them to go to the <code>home activity</code>.</p>
  
  <p>So it seems I have to have a activity that will be a loading activity that will do the checking and decide which activity will be started.</p>
  
  <p>However, as checking the shared preferences will be a very quick operation I don't really want to show any UI, as it will be pointless if just flashes passed and goes to the next activity.</p>
  
  <p>Is there any way to have some headless activity that will just do the checking but don't display any UI.</p>
  
  <p>Is there anyway to do the checking in the <code>Login activity</code> before inflating a layout?</p>
  
  <p>I am not doing any facebook, google, or any social media login.</p>
  
  <p>Just wondering what is the best practice to handle this.</p>