title: How to store all child fragment classes to the parent class' instance
body: <p>I'm working on a "home feed"-like feature where there's a main <code>Fragment</code> with several other fragments added to its layout, making up the content page. I'd like the main fragment class to be able to instanstiate all the fragment classes that inherit from a certain parent fragment class. This way the code would be more dynamic instead of adding a bunch of <code>&lt;fragment&gt;</code> tags to my xml files. </p>
  
  <p>I'm kinda stuck on making up a decent architecture. How would you go on about doing this?</p>
  
  <p>UPDATE:
  Here's what I'm basically trying to do, but don't know how:</p>
  
  <pre><code>public class FeedFragment extends Fragment {
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
          View parentView = inflater.inflate(R.layout.fragment_home, container, false);
  
          // Get fragments and dynamically add them to
          // the FeedFragment's layout
          getEntryFragmentsList();
          // ...
  
          return parentView;
      }
  }
  
  public abstract class FeedEntryFragment extends Fragment {
     // Somehow add fragment to list of entry fragments
  }
  
  public class TestFragment extends FeedEntryFragment {
      // Already added to list of entry fragments
  }
  </code></pre>