C# 用API请求的结果填充微调器
我想用API请求的结果填充微调器,以获得此方法C# 用API请求的结果填充微调器,c#,android,xamarin,C#,Android,Xamarin,我想用API请求的结果填充微调器,以获得此方法 public async Task<List<String>> LoadSection(string userID) { var client = new HttpClient(); var response = await client.GetAsync(PRSNCEServer + "/retrievesections.php?userID=" + userID);
public async Task<List<String>> LoadSection(string userID)
{
var client = new HttpClient();
var response = await client.GetAsync(PRSNCEServer + "/retrievesections.php?userID=" + userID);
var result = await response.Content.ReadAsStringAsync();
List<string> records = JsonConvert.DeserializeObject<List<string>>(result);
return records;
}
public async Task LoadSection(字符串userID)
{
var client=新的HttpClient();
var response=wait client.GetAsync(PRSNCEServer+“/retrievesections.php?userID=“+userID”);
var result=await response.Content.ReadAsStringAsync();
列表记录=JsonConvert.DeserializeObject(结果);
退货记录;
}
此时,我完全不知所措,不知道如何将其转换为arrayadapter,以便将内容放置到微调器
有什么想法吗?只需创建
ArrayAdapter
()
var myAdapter=new ArrayAdapter(这个,Android.Resource.Layout.SimpleListItem1,记录);
我以前也尝试过,但我发现错误无法从“System.Threading.Tasks.Task”转换为“int”ArrayAdapter有很多重载,听起来好像使用了错误的重载。
var myAdapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItem1, records);