title: App Crashes When Resumed from minimize After long time
body: <p>I am working on Taxi Tracking App in which i am tracking stop points for tracking taxi. when user starts app he selects taxi no and start tracking and app goes to minimize and tracking started using service.</p>
  
  <p>when i walk for 1-2 hour and app is in minimize state and when i click on app icon app gives null pointer exception on spinner "on item selected listener" (NULL Pointer Exception).</p>
  
  <p>I am setting adapter of spinner from database (list of taxis).but when i restore app from minimize then why app crashes.</p>
  
  <p>why <strong>onitemselectedlistener</strong> event is called  ??
  why it gives null pointer exception in listener because app is in run state already.it was just in background using home intent.</p>
  
  <pre><code>    Intent startMain = new Intent(Intent.ACTION_MAIN);
      startMain.addCategory(Intent.CATEGORY_HOME);
      startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      startActivity(startMain);
  </code></pre>
  
  <p>please help me.</p>