title: Storing session state in android application
body: <p>I know that the question is rather frequent, but it looks like I have to ask it anyway.</p>
  
  <p>I am developing a network game. The app holds current user's account info, team info, units, private messages etc. to provide a permanent access to them. I've created a class that holds all of those, and now I am loading session data each time on the app startup, showing splash activity. The session data instance lies in the <code>Application</code> class  child.</p>
  
  <p>Every time, in every Activity's <code>onCreate</code> and <code>onResume</code> I check if the session data is alive, and if it is not, I start the splash activity to reload it. I know that the way is a kind of a bad practice, but it looks like the fastest approach to manage session.</p>
  
  <p>Recently, I've started a beta testing for my app and faced a plenty of NPE's in objects targeting session data objects, despite my <code>onCreate</code> and <code>onResume</code> checks.</p>
  
  <p>Can anybody suggest a better approach to the problem?</p>
  
  <p>Additionally,</p>
  
  <ul>
  <li>The session data has a huge amount of object types to store, so It will be really tediously to create all databases for them;</li>
  <li>The session data is modified frequently on the server, so it is not a good idea to load everything once and use forever.</li>
  </ul>