My code is:
public BarData getBarData(String fieldName) {
ArrayList<BarEntry> entries = new ArrayList<>();
entries.add(new BarEntry(this.house.Population, 0));
entries.add(new BarEntry(this.currentStore.Population, 1));
ArrayList<String> labels = new ArrayList<String>();
labels.add("house");
labels.add("store" + this.currentStore.StoreName);
List<BarDataSet> dataSets = new ArrayList<>();
dataSets.add(new BarDataSet(entries, fieldName));
return new BarData(labels, dataSets);
}
According to the document, the BarData constructor is similar to the code above. But why does Android Studio always tell me that something is wrong?
Error message:
Error:(97, 16) error: constructor BarData in class BarData cannot be applied to given types;
required: IBarDataSet[]
found: List<String>,List<BarDataSet>
reason: varargs mismatch; List<String> cannot be converted to IBarDataSet
Please give me some information. I really need some help.
Thank.
source
share