title: Do fragments really need an empty constructor?
body: <p>I have a <code>Fragment</code> with a constructor that takes multiple arguments. My app worked fine during development, but in production my users sometimes see this crash:</p>
  
  <pre class="lang-none prettyprint-override"><code>android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment 
  make sure class name exists, is public, and has an empty constructor that is public
  </code></pre>
  
  <p>I could make an empty constructor as this error message suggests, but that doesn't make sense to me since then I would have to call a separate method to finish setting up the <code>Fragment</code>.</p>
  
  <p>I'm curious as to why this crash only happens occasionally. Maybe I'm using the <code>ViewPager</code> incorrectly? I instantiate all the <code>Fragment</code>s myself and save them in a list inside the <code>Activity</code>. I don't use <code>FragmentManager</code> transactions, since the <code>ViewPager</code> examples I have seen did not require it and everything seemed to be working during development.</p>