title: Using onSaveInstanceState with fragments in backstack?
body: <p>I have fragments I keep in the backstack of FragmentManager. Every fragment state is saved for orientation changes with member variables, like this for example: </p>
  
  <pre><code>@Override
  public void onSaveInstanceState(Bundle outState) 
  {
      super.onSaveInstanceState(outState);
      outState.putLong("userId", mUserId);
      outState.putString("username", mUsername);
  }
  </code></pre>
  
  <p>My problem is that if there is an orientation change, since every fragment in the backstack gets called via onSaveInstanceState, I get a null pointer exception because the member variables don't exist anymore.</p>
  
  <p>Any ideas on how to solve this?</p>