title: Fragments inside a fragment Android application
body: <p>I'm trying to put 2 fragments inside a fragment. I found some code on internet but, as far as I could go, I don't succeed to put 2 fragments in 1 fragment. 
  I have seen tips dealing with FragmentManager and especially the method getChildFragmentManager() but I don't know how it works with 2 fragments.</p>
  
  <p>For the story, I'm using an activity with ActionBar which creates 3 fragments. In one of them, I need to handle a graph and a kind of menu to change the graph scale. In this way, I need 2 fragments in one fragment.</p>
  
  <p>Here is the code :</p>
  
  <p>The fragment which handles the others:</p>
  
  <pre><code>public class GraphDisplayFragment extends Fragment {
  
  @Override
   public View onCreateView(LayoutInflater inflater, ViewGroup container,
     Bundle savedInstanceState) {
  
    View myFragmentView = inflater.inflate(R.layout.graph_fragment, container, false);
  
    return myFragmentView;
  
   }
  }
  </code></pre>
  
  <p>The code to draw the graph:</p>
  
  <pre><code>public class GraphFragment extends Fragment {
  private static final int SERIES_NR = 1;
  
  @Override
   public View onCreateView(LayoutInflater inflater, ViewGroup container,
     Bundle savedInstanceState) {
  
    GraphicalView myFragmentView = ChartFactory.getTimeChartView(this.getActivity(), getDateDemoDataset(), getDemoRenderer(),null);
    return myFragmentView;
  
   }
  
  //some functions to set graph propreties
  }
  </code></pre>
  
  <p>The XML files : </p>
  
  <p>graph_fragment.xml</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical" &gt;   
  &lt;fragment
      android:id="@+id/graph_fragment"
      android:name="com.test.GraphFragment"
      android:layout_width="match_parent"
      android:layout_height="259dp" &gt;
  
  &lt;/fragment&gt;
  &lt;fragment
      android:name="com.test.GraphDetailFragment"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:id="@+id/graph_detail_fragment"&gt;
  &lt;/fragment&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>graph_detail.xml with a test implementation</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical" &gt;
  &lt;TextView
      android:id="@+id/textView1"
      android:layout_width="211dp"
      android:layout_height="wrap_content"
      android:text="TextView" /&gt;
   &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>The weird thing is, it works at the begining when I switch between fragments in the ActionBar but after 3-4 moves, I get this error : </p>
  
  <pre><code>android.view.InflateException: Binary XML file line #7: Error inflating class fragment
  </code></pre>
  
  <p>If anyone has the solution, it would be awesome!</p>