Place cursor at the end of text in EditText

android, android-edittext, java, keylistener, kotlin

Solution

Try this:

UPDATE:

Kotlin:

editText.setSelection(editText.length())//placing cursor at the end of the text

Java:

editText.setSelection(editText.getText().length());

Problem

I am changing the value of an `EditText` on `keyListener`. But when I change the text the cursor is moving to the beginning of the `EditText`. I need the cursor to be at the end of the text. How to move the cursor to the end of the text in a `EditText`.

Original source

Related problems