I have the following class:
public class LineChart extends AppCompatActivity{
private LineChart mChart;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_line_chart);
mChart = findViewById(R.id.linechart);
}
}
And an XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/relativeLayout">
<com.github.mikephil.charting.charts.LineChart
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/linechart">
</com.github.mikephil.charting.charts.LineChart>
My problem now is that when i try to get the Line Chart with findViewById(R.id.linechart)
i get the error:
Error:(42, 24) error: incompatible types: no unique maximal instance exists for type variable T with upper bounds LineChart,View where T is a type-variable: T extends View declared in method findViewById(int)
If you look in the MPAndroidChart Wiki you will see that i did nothing wrong (i hope). Can someone tell me please where my mistake is. Thanks in advance