title: What to save in onSaveInstanceState?
body: <p>I think there is something I didn't really understand in the onSaveInstanceState mechanism:
  I have a class which contains several datas: </p>
  
  <pre><code>public class Site implements Serializable {
  
      private static final long serialVersionUID = 1L;
      // used to save device language when the application starts
      private String deviceLanguage;
      private int deviceWifiState;
      private int deviceWifiNetworkId;
  
      private String localeLanguage;
  
      // URLs to access various files to describe site and points of interests
      private String wifiSSID = null;
      private String wifiWPAKey = null;
      private String url = null;
      private String flagsDir = "flags/";
      private String flagsUrl = null;
      private String mediasDir = "medias/";
      private String mediasUrl = null;
      private String descriptionFileUrl = null;
      private FragmentActivity activity;
  
      private ArrayList&lt;Language&gt; listLanguages = null;
      private ArrayList&lt;PointOfInterest&gt; listPointsOfInterest = null;
  
      ...
      // and some getter/setter
  }
  </code></pre>
  
  <p>So the <code>MainActivity</code> inflate a <code>Fragment_init</code> which starts to fill in the Site class.
  Mainly the ArrayList.</p>
  
  <p>This <code>Fragment_init</code> is not in the back stack.
  When the job is done, it automatically commit() a new <code>Fragment_selectLanguage</code> where the user set its language before continuing the initialisation.
  Once done, this thread is put in the back stack and a third Fragment_play() in commited.</p>
  
  <p>All fragments implement the following <code>onsaveInstanceState</code> method, with the Bundle getted back on their <code>onViewCreated</code> method.</p>
  
  <pre><code>@Override
  public void onSaveInstanceState(Bundle saveInstanceState) {
      super.onSaveInstanceState(saveInstanceState);
  
      saveInstanceState.putSerializable(FRAGMENT_SELECT_LANGUAGE_SITE, (Serializable) site);
  }
  </code></pre>
  
  <p>While in the third fragment, if I change the screen orientation then go back to the previous fragment, I get a null pointer exception when it uses listeLanguages, normally initialized in the first fragment, which is null.</p>
  
  <p>When I examine the Site class, I see that most of the datas are inside but some, often the arrays, are null.</p>
  
  <p>What do I miss? I was thinking that the whole Site class was saved !?</p>
  
  <p>Regards,</p>