When changing the value of EditText in the keyListener There's a cursor at the beginning of EditText, and I want to put it at the end of the text. How do I move the cursor to the end?
android keylistener android-edittext
EditText et = (EditText)findViewById(R.id.inbox);
et.setSelection(et.getText().length());
Write setSelection()
. It's a method to move the position of the cursor, and et.getText returns the text of et
length() means to return the length of the text. So this will move the cursor to the end of the text.
618 Uncaught (inpromise) Error on Electron: An object could not be cloned
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
915 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
612 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.