I want to disable the editText once timer is finished. Have a look on the following code:
val CountDownTimer=object: CountDownTimer(10000,1000){
override fun onTick(millisUntilFinished: Long) {
txtTimer.setText(""+millisUntilFinished/1000)
}
override fun onFinish() {
Toast.makeText(this@Play_Area,"time up!",Toast.LENGTH_SHORT).show()
etResponse.isEnabled(false)
}
}
Here etResponse is EditText
and when i make #isEnables(false)
it is showing following error:
Too many arguments for public open fun isEnabled()
: Boolean defined in android.widget.EditText
Please Help How to resolve it
You are using the wrong function.
editText.isEnabled()
is used to return the enabled state only and it doesn't take an argument so you can call it like thatinstead, you should use
editText.isEnabled = true
because the property is mutable