How to solve an error "Type mismatch. Required: Editable Found: String" in Android Studio (Kotlin)

This  problem appears when you try to write a string instead of an Editable into an EditText element .

Wrong usage example: 

 binding.myEdit.text = "12345"

The solution is to write text using the setText method:


If you do not use View Binding, then see this example:

val txt = findViewById ( as EditText
txt.text = "12345" // an error
txt.setText("12345") //correct


No comments yet, you can leave yours: