title: Android: How to save objects initialised in the Application class when the System Restarts my App Process
body: <p>In my application class i have a <strong>Object</strong> which is used by all the activities that are launched from Launcher screen. The problem is, In low memory case the system automatically Restarts my Application (i could see that in Settings -> Application -> Running Process Tab). Since it is restarting (that happens once the app is in background), the Object which i am using throughout is being reset to null. </p>
  
  <p><strong>My Scenario:</strong></p>
  
  <p>In my Launcher Activity, i am hitting the DB and takes the value in a thread and using Setter &amp; Getter i am setting the Object value in the Application class.</p>
  
  <p>After setting it i am moving to four activities from there A(Launcher) -> B -> C -> D</p>
  
  <p>Now i am going background and my device is running in Low memory, my process is killed and restarted at this point (i.e, in background).</p>
  
  <p>At the restart my Object is reset to null, Now if i launch my app from the recentlist or through the Launcher, it is still launching the last Activity from where i went background in the above case it is Activity D, where i am accessing the Object which throws Null-pointer.</p>
  
  <p><strong>My question is,</strong> </p>
  
  <ol>
  <li>Is there any way to save the Object at the Application class level when system kills it (like we do in the Activity onSaveInstanceState).</li>
  </ol>