如何使用适配器将 json 对象结果放入列表视图中?
对象类
public class ScVsrList
{
public int vnd { get; set; }
public string drref { get; set; }
public int dpt { get; set; }
public string dname { get; set; }
public int sdp { get; set; }
public int cls { get; set; }
public string cname { get; set; }
public int ctn { get; set; }
public List<ScDrList> drList2 { get; set; }
}
public class ScDrList
{
public int vnd2 { get; set; }
public string drref { get; set; }
}
public class StoreConsignorVsrObject
{
public string status { get; set; }
public string env { get; set; }
public string vsr { get; set; }
public string type { get; set; }
public List<ScVsrList> drList { get; set; }
}
*我的代码使用 XAMARIN ANDROID 的 REST 客户端*
var client = new RestClient("http://10.121.4.72:10010/web/services/getVSRdt");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-type", "application/json");
var requestObject = new VsrRequestObject
{
env = "DSP",
vsr = GlobalVariable.VsrNumber,
token = "967F058F023DA12798F2D41CDC2F2A5C6D4A6F5D40069A80V3S98R9RFPDT"
};
request.AddJsonBody(requestObject);
var response = client.Execute(request);
var content = response.Content;
StoreConsignorVsrObject item = JsonConvert.DeserializeObject<StoreConsignorVsrObject>(content);
if (item != null)
{
LayoutInflater inflate = LayoutInflater.From(this);
View view = inflate.Inflate(Resource.Layout.activity_storeconsignorvsrmonitoring, null);
alertBuilder = new Android.Support.V7.App.AlertDialog.Builder(this);
alertBuilder.SetView(view);
contentDialog = alertBuilder.Create();
GCT1015
相关分类