【发布时间】:2015-11-22 19:28:05
【问题描述】:
我有按钮“+”和“-”的活动
当我点击“+”时,我的产品数量变为 +1
我有价格,它从 json 解析。
我需要将“price”字段转换为 int 并在点击“+”时提高价格。
我该怎么做?
我的活动代码:
private void ParseAndDisplay(JsonValue json)
{
TextView productname = FindViewById<TextView>(Resource.Id.posttitle);
TextView content = FindViewById<TextView>(Resource.Id.postcontent);
TextView price = FindViewById<TextView>(Resource.Id.price);
TextView weight = FindViewById<TextView>(Resource.Id.weight);
ImageView imagen = FindViewById<ImageView>(Resource.Id.image1);
JsonValue firstitem = json[4];
productname.Text = firstitem["post_title"];
content.Text = firstitem["post_excerpt"];
price.Text = firstitem["price"] + " грн";
weight.Text = firstitem["weight"] + "г";
var imageBitmap2 = GetImageBitmapFromUrl(firstitem["img_url"]);
imagen.SetImageBitmap(imageBitmap2);
}
【问题讨论】: