In the code written: multiple Toast.makeText(this, "", Toast.LENGTH_SHORT).show()
......
Toast.makeText(this, "", Toast.LENGTH_SHORT).show()
......
Toast.makeText(this, "", Toast.LENGTH_SHORT).show()
......
Toast.makeText(this, "", Toast.LENGTH_SHORT).show()
......
Toast.makeText(this, "", Toast.LENGTH_SHORT).show()
......
Toast.makeText(this, "", Toast.LENGTH_SHORT).show()
......
It seems to be troublesome, you can write: a function of multiple showToast functions is called to a Toast.makeText(this, "", Toast.LENGTH_SHORT).show()
......
showToast(mErrorMsg)
......
showToast(mErrorMsg)
......
showToast(mErrorMsg)
......
showToast(mErrorMsg)
......
showToast(mErrorMsg)
......
......
......
private fun showToast(msg: String) {
Toast.makeText(this, msg, Toast.LENGTH_SHORT).show()
}