Home > Blockchain >  How can I display a number in an EditText (kotlin)
How can I display a number in an EditText (kotlin)

Time:05-11

So I have a number and I want to show it in an EditText I managed to do it but only If I get the number from another edittext so If I have a val myNumber = 5 how can I make to show it in edittext? (not TextView its EditText)

exemple myEditText.text = myNumber

CodePudding user response:

Indeed, the .text method from EditText expects an Editable object, same as when we get the text from the edit text is as well an Editable that we have to parse to string, e.g. editText.text.toString().

To set a string in to a EditText use: editText.setText("string")

  • Related