gpt4 book ai didi

java - 错误 :(61, 48) 错误:不兼容的类型:字符串无法转换为 mpandroidchart 中的 List

转载 作者:行者123 更新时间:2023-12-02 12:00:07 24 4
gpt4 key购买 nike

我在显示 myTable.java 中的数据时收到此错误。显示不兼容的类型

BarChart chart = (BarChart) findViewById(R.id.datachart);

ArrayList<String> BarEntry = new ArrayList<>();

BarEntry.add(myTable.getPopulation_1980());

ArrayList<String> labels = new ArrayList<>();
labels.add("1980");
labels.add("1985");
labels.add("1990");


BarDataSet bardataset = new BarDataSet(BarEntry, "Cells");
BarData data = new BarData(labels, bardataset);
chart.setData(data);

但在 Bardataset bardataset = new Bardadtaset(BarEntry, "cells")

上显示错误

请给我任何建议

最佳答案

incompatible types: String cannot be converted to List in mpandroidchart

 BarDataSet bardataset = new BarDataSet(BarEntry, "Cells");

The constructor for BarData has changed in v3.0.0

阅读Setting Data .

public BarDataSet(List<BarEntry> yVals, String label) {
super(yVals, label);

......
}

关于java - 错误 :(61, 48) 错误:不兼容的类型:字符串无法转换为 mpandroidchart 中的 List<BarEntry>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47328087/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com