问题描述
在填充微调器数组时遇到问题,它表示转换无效。 您能帮我解决这个问题吗?
private async void getplant()
{
string url = "http://localhost/VMSAPINEW2/MasterData/getplantlist";
JsonValue json = await FetchWeatherAsync(url);
string temp = "";
ArrayList items = new ArrayList();
for (int i = 0; i < json.Count; i++)
{
temp = json[i]["plantName"].ToString();
items.Add(temp);
}
var adapter = new ArrayAdapter<string>(this,Android.Resource.Layout.SimpleSpinnerItem,(IList<string>)items);
spinnerPlantNormal.Adapter = adapter;
}
项目的结果是
item[0] "\"SBM - BIKE\""
item[1] "\"SBM - ROD\""
和错误 System.InvalidCastException:“指定的转换无效。” 当用数组填充适配器时。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)