title: How to serialize an object that are in a library?
body: <p>I am developing an Android application and need to store some objects to the disk for some reason (with the <code>onSaveInstanceState()</code> method) and then retrieve them back again (with the <code>onRestoreInstanceState()</code> method) with Serialization/Parcelable.</p>
  
  <p>As you might know, to make a class as Parcelable, you need to use <a href="https://github.com/johncarl81/parceler" rel="nofollow noreferrer">Parceler</a> Library or write some boilerplate code.</p>
  
  <p>My problem is, that I have some objects that don't write their class. They are a 3rd party or Android-Sdk related Class. For clarity here is my code:</p>
  
  <pre><code>private FragNavController mNavController;
  private MenuItem mMenuItem;
  private SharedPreferences mPrefs;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      LayoutInflaterCompat.setFactory(getLayoutInflater(), new IconicsLayoutInflater(getDelegate()));
      setDefaultLanguage(Locale.ENGLISH.toString());
      //Paper.init(getApplicationContext());
  
      mPrefs = getPreferences(MODE_PRIVATE);
      super.onCreate(savedInstanceState);
      .
      .
      .
  }
  </code></pre>
  
  <p>I use <a href="https://github.com/johncarl81/parceler" rel="nofollow noreferrer">Parceler</a> Library, <a href="https://github.com/x-stream/xstream" rel="nofollow noreferrer">Xstream</a> ,<a href="https://github.com/frankiesardo/icepick" rel="nofollow noreferrer">icepick</a>, <a href="https://github.com/pilgr/Paper" rel="nofollow noreferrer">paper</a>, <a href="https://stackoverflow.com/questions/7145606/how-android-sharedpreferences-save-store-object">Gson and sharedPreferences Method</a>, but in all of them, I fail to save some objects like <code>mNavController</code> and <code>mMenuItem</code>.</p>
  
  <p>Has anyone faced this problem before and know the best solution to save these objects?</p>