title: Pass custom class to Fragment
body: <p>I have a custom class called Data which contains all the data. The main activity creates two fragments. I have a field in the main activity like this:</p>
  
  <pre><code>private Data data = new Data();
  </code></pre>
  
  <p>The fragments are created with this method:</p>
  
  <pre><code>private ArrayList&lt;Fragment&gt; getFragments() {
      ArrayList&lt;Fragment&gt; fragments = new ArrayList&lt;Fragment&gt;();
      fragments.add(new fragment_one());
      fragments.add(new fragment_two());
      return fragments;
  }
  </code></pre>
  
  <p>I need to pass the data field to the fragments, so the fragments can acces the methods of Data.</p>
  
  <p>I tried by creating a bundle, but I can't pass a custom class. What can I do?</p>