title: Using MPChartLibrary within a fragment
body: <p>I am working on an Android project and I am trying to implement a Library called MPAndroidChart from <a href="https://github.com/PhilJay/MPAndroidChart" rel="nofollow noreferrer">https://github.com/PhilJay/MPAndroidChart</a>. </p>
  
  <p>I am trying to implement it in a fragment but I keep getting an error and I cannot see why. </p>
  
  <p>Below is my activity. </p>
  
  <pre><code>public class MainActivity extends ActionBarActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
          Fragment chartFragment = new ChartFragment();
          transaction.replace(R.id.fragmentContainer, chartFragment);
          transaction.commit();
      }
  }
  </code></pre>
  
  <p>Below is my activities layout</p>
  
  <pre><code>&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;include layout="@layout/toolbar" /&gt;
      &lt;FrameLayout android:id="@+id/fragmentContainer"
          android:layout_width="match_parent"
          android:layout_height="match_parent" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Below is my Fragment class</p>
  
  <pre><code>public class ChartFragment extends Fragment
  {
      private LineChart mChart;
  
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          View v = inflater.inflate(R.layout.graph, container, false);
  
  
  
          return v;
      }
  }
  </code></pre>
  
  <p>And below is the layout for the fragment</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
      &lt;com.github.mikephil.charting.charts.LineChart
          android:id="@+id/lineChart1"
          android:layout_width="match_parent"
          android:layout_height="match_parent" /&gt;
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>At the moment it crashes when it tries to inflate the view in my OnCreateView function. </p>
  
  <p>The error I am getting is:</p>
  
  <blockquote>
    <p>java.lang.RuntimeException: Unable to start activity
    ComponentInfo{com.MyCompany.ChartTest/com.MyCompany.ChartTest.MainActivity}:
    android.view.InflateException: Binary XML file line #5: Error
    inflating class com.github.mikephil.charting.charts.LineChart</p>
  </blockquote>