So I am using MPAndroidChart LineCharts which means in XML I define it this way:
<com.github.mikephil.charting.charts.LineChart
android:id="@+id/line_chart"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
However I am trying to use this chart using various default settings and so on, so I made a custom class to try to extend it:
public class MyLineChart extends com.github.mikephil.charting.charts.LineChart {
private Context mContext;
public MyLineChart(Context context) {
super(context);
mContext = context;
}
//...
And so elsewhere in my code when I want to use it, I have:
private MyLineChart mChart;
...
mChart = new MyLineChart(getActivity());
mChart = (MyLineChart) findViewById(R.id.line_chart);
And it all seems to compile fine, but then it throws a runtime error because it says I cannot convert the LineChart to MyLineChart.