Place cursor at the end of text in EditText

Manu picture Manu · Jun 2, 2011 · Viewed 298.7k times · Source

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.

Answer

Marqs picture Marqs · Jul 8, 2011

Try this:

EditText et = (EditText)findViewById(R.id.inbox);
et.setSelection(et.getText().length());