val a = result.text.toString() val b = resultHist1.text.toString() if(!a.isNullOrEmpty() && !b.isNullOrEmpty() ){ val a = a.toInt() val b = b.toInt() calcHist1.text = (a+b).toString() } else { calcHist1.text = "" }