我想在单击增加btn或减少btn之前使显示器显示“ 16000 $”。 当我制作由:java.lang.NumberFormatException引起的类似此错误的代码时:对于输入字符串:“ 16000 $,但是我应该显示$。让我们检查我的代码并帮助我吧。
var productprice = findViewById<TextView>(R.id.productPrice)
productprice.text= intent.getStringExtra("price")+"$"
var price = productPrice.text.toString().toInt()
var inc_val= price
var getPrice = price
decrease.isEnabled=false
increase.setOnClicklistener {
increaseInteger()
getPrice+= inc_val
productprice.text=getPrice.toString()+"$"
}
decrease.setOnClicklistener {
decreaseInteger()
getPrice -= inc_val
productprice.text=getPrice.toString()+"$"
}