I need to focus on the last character of EditText by coding way. I know that there is EditText.requestFocus, but it set focus on the first character. I'm using java.
After the call to requestFocus(), you can set the position of the cursor at the end of the EditText as follows:
EditText editText = (EditText) findViewById(R.id.textId);
int pos = editText.getText().length();
editText.setSelection(pos);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With